SEO: favicon metadata, Organization JSON-LD, favicon validation; R2 media (preconnect, generateFileURL per-collection), filename normalization
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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 function buildOrganizationJsonLd({ name, logo, sameAs, url }: OrganizationJsonLdArgs) {
|
||||
const logoUrl = logo?.url
|
||||
|
||||
return {
|
||||
name,
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Organization',
|
||||
url,
|
||||
...(logoUrl ? { logo: logoUrl.startsWith('http') ? logoUrl : `${url}${logoUrl}` } : {}),
|
||||
...(sameAs && sameAs.length > 0 ? { sameAs } : {}),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user