42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
type MediaLike = {
|
|
url?: null | string;
|
|
} | null | undefined;
|
|
type OrganizationJsonLdArgs = {
|
|
/** Logo media (from panel). Google uses this for brand knowledge panels. */
|
|
logo?: MediaLike;
|
|
/** Organization / site name. */
|
|
name: string;
|
|
/** Optional social / official profile URLs (sameAs). */
|
|
sameAs?: string[];
|
|
/** Absolute site URL (https://…). */
|
|
url: string;
|
|
};
|
|
/**
|
|
* Builds Organization JSON-LD (schema.org) — helps Google associate the site
|
|
* with a brand: name, logo, official links. Improves how the site appears in
|
|
* search (brand recognition, logo in knowledge panels) and is a signal used
|
|
* alongside favicon for identity.
|
|
*
|
|
* Returns a plain object; the project renders it as a <script type="application/
|
|
* ld+json"> in the root layout:
|
|
*
|
|
* import { buildOrganizationJsonLd } from '@intecion/ipal-kit'
|
|
* const jsonLd = buildOrganizationJsonLd({
|
|
* name: settings.siteName, url: baseUrl, logo: settings.logo,
|
|
* })
|
|
* <script type="application/ld+json"
|
|
* dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} />
|
|
*
|
|
* Data comes from the panel (siteName, logo) — nothing hardcoded. Emit once in
|
|
* the root layout (Organization is site-wide, not per page).
|
|
*/
|
|
export declare function buildOrganizationJsonLd({ name, logo, sameAs, url }: OrganizationJsonLdArgs): {
|
|
sameAs?: string[] | undefined;
|
|
logo?: string | undefined;
|
|
name: string;
|
|
'@context': string;
|
|
'@type': string;
|
|
url: string;
|
|
};
|
|
export {};
|