1.2.0: local SEO structured data (LocalBusiness, Service, FAQPage), noindex per page
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
type ServiceJsonLdArgs = {
|
||||
/** Area served, e.g. 'Wrocław' or ['Wrocław', 'Oława']. */
|
||||
areaServed?: string | string[]
|
||||
description?: string
|
||||
/** Service name, e.g. 'Sprzątanie biur'. */
|
||||
name: string
|
||||
/** Provider (business) name. */
|
||||
providerName: string
|
||||
/** Service type / category. */
|
||||
serviceType?: string
|
||||
url: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds Service JSON-LD (schema.org) for a service offering. Helps Google
|
||||
* understand "what this page sells" — useful for service landing pages
|
||||
* ("usługa + miasto"). Pairs well with LocalBusiness (the provider).
|
||||
*
|
||||
* Per-page (each service page emits its own), data from the panel:
|
||||
*
|
||||
* import { buildServiceJsonLd } from '@intecion/ipal-kit'
|
||||
* const jsonLd = buildServiceJsonLd({
|
||||
* name: page.serviceName, providerName: company.name,
|
||||
* url: pageUrl, areaServed: 'Wrocław',
|
||||
* })
|
||||
*/
|
||||
export function buildServiceJsonLd({
|
||||
name,
|
||||
areaServed,
|
||||
description,
|
||||
providerName,
|
||||
serviceType,
|
||||
url,
|
||||
}: ServiceJsonLdArgs) {
|
||||
return {
|
||||
name,
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Service',
|
||||
provider: {
|
||||
name: providerName,
|
||||
'@type': 'LocalBusiness',
|
||||
url,
|
||||
},
|
||||
...(description ? { description } : {}),
|
||||
...(areaServed ? { areaServed } : {}),
|
||||
...(serviceType ? { serviceType } : {}),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user