type WebPageJsonLdArgs = { /** ISO date of the last change — a freshness signal for search and AI. */ dateModified?: string description?: string /** Absolute URL of a representative image. */ image?: string /** BCP 47 language of the page, e.g. 'pl'. */ inLanguage?: string name: string /** 'WebPage' (default), 'CollectionPage' (archive listing), 'AboutPage', 'ContactPage', 'FAQPage'… */ type?: string /** Absolute URL of the page (also its @id). */ url: string /** Absolute URL of the site root — links the page to the WebSite node. */ websiteUrl?: string } /** * schema.org WebPage node for one page: name, description, language, last * modification and the site it belongs to. Gives search engines and AI * assistants explicit facts (what, which language, how fresh) instead of * inferring them from HTML. Render through ; data from the panel. */ export function buildWebPageJsonLd({ name, type = 'WebPage', dateModified, description, image, inLanguage, url, websiteUrl, }: WebPageJsonLdArgs) { return { name, '@id': url, '@type': type, url, ...(description ? { description } : {}), ...(inLanguage ? { inLanguage } : {}), ...(dateModified ? { dateModified } : {}), ...(image ? { primaryImageOfPage: { '@type': 'ImageObject', url: image } } : {}), ...(websiteUrl ? { isPartOf: { '@type': 'WebSite', url: websiteUrl } } : {}), } }