| 1 | import { DISCORD_URL, REPO_URL } from "./i18n/links"; |
| 2 | import { IDENTITY_PHRASE, SITE_NAME, SITE_URL } from "./page-meta"; |
| 3 | |
| 4 | export const ORGANIZATION_ID = `${SITE_URL}/#organization`; |
| 5 | export const WEBSITE_ID = `${SITE_URL}/#website`; |
| 6 | export const ORGANIZATION_LOGO_URL = `${SITE_URL}/icon.svg`; |
| 7 | |
| 8 | /** |
| 9 | * Site-wide Organization + WebSite graph. |
| 10 | * `inLanguage` is the routed locale of the document that embeds this block. |
| 11 | */ |
| 12 | export function buildSiteJsonLd(locale: string) { |
| 13 | return { |
| 14 | "@context": "https://schema.org", |
| 15 | "@graph": [ |
| 16 | { |
| 17 | "@type": "Organization", |
| 18 | "@id": ORGANIZATION_ID, |
| 19 | name: SITE_NAME, |
| 20 | url: SITE_URL, |
| 21 | logo: { |
| 22 | "@type": "ImageObject", |
| 23 | url: ORGANIZATION_LOGO_URL, |
| 24 | }, |
| 25 | sameAs: [REPO_URL, DISCORD_URL], |
| 26 | }, |
| 27 | { |
| 28 | "@type": "WebSite", |
| 29 | "@id": WEBSITE_ID, |
| 30 | name: SITE_NAME, |
| 31 | url: SITE_URL, |
| 32 | description: IDENTITY_PHRASE, |
| 33 | inLanguage: locale, |
| 34 | publisher: { "@id": ORGANIZATION_ID }, |
| 35 | }, |
| 36 | ], |
| 37 | }; |
| 38 | } |
| 39 |