72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
type MediaLike = {
|
|
url?: null | string;
|
|
} | null | undefined;
|
|
type Address = {
|
|
city?: string;
|
|
country?: string;
|
|
postalCode?: string;
|
|
region?: string;
|
|
street?: string;
|
|
};
|
|
type LocalBusinessJsonLdArgs = {
|
|
address?: Address;
|
|
/** Geo coordinates for maps/local search. */
|
|
geo?: {
|
|
latitude: number;
|
|
longitude: number;
|
|
};
|
|
image?: MediaLike;
|
|
logo?: MediaLike;
|
|
name: string;
|
|
/** Opening hours, e.g. ['Mo-Fr 08:00-18:00', 'Sa 09:00-14:00']. */
|
|
openingHours?: string[];
|
|
priceRange?: string;
|
|
sameAs?: string[];
|
|
/** Business phone, e.g. '+48 123 456 789'. */
|
|
telephone?: string;
|
|
url: string;
|
|
};
|
|
/**
|
|
* Builds LocalBusiness JSON-LD (schema.org) — the key structured data for LOCAL
|
|
* SEO. Helps Google show the business in local results / map pack with address,
|
|
* hours, phone. Strong signal for "usługa + miasto" queries.
|
|
*
|
|
* All data from the panel (company global) — nothing hardcoded. Emit once in the
|
|
* root layout (business is site-wide):
|
|
*
|
|
* import { buildLocalBusinessJsonLd } from '@intecion/ipal-kit'
|
|
* const jsonLd = buildLocalBusinessJsonLd({
|
|
* name: company.name, url: baseUrl, telephone: company.phone,
|
|
* address: company.address, openingHours: company.hours,
|
|
* })
|
|
*
|
|
* For a more specific type (e.g. 'Dentist', 'Plumber'), override @type in the
|
|
* returned object — schema.org has many LocalBusiness subtypes.
|
|
*/
|
|
export declare function buildLocalBusinessJsonLd({ name, address, geo, image, logo, openingHours, priceRange, sameAs, telephone, url, }: LocalBusinessJsonLdArgs): {
|
|
sameAs?: string[] | undefined;
|
|
priceRange?: string | undefined;
|
|
openingHours?: string[] | undefined;
|
|
geo?: {
|
|
'@type': string;
|
|
latitude: number;
|
|
longitude: number;
|
|
} | undefined;
|
|
address?: {
|
|
addressCountry?: string | undefined;
|
|
addressRegion?: string | undefined;
|
|
postalCode?: string | undefined;
|
|
addressLocality?: string | undefined;
|
|
streetAddress?: string | undefined;
|
|
'@type': string;
|
|
} | undefined;
|
|
logo?: string | undefined;
|
|
image?: string | undefined;
|
|
telephone?: string | undefined;
|
|
name: string;
|
|
'@context': string;
|
|
'@type': string;
|
|
url: string;
|
|
};
|
|
export {};
|