| 1 | import type { PublishedReleaseFact } from "./facts"; |
| 2 | import { REPO_URL } from "./i18n/links"; |
| 3 | import { IDENTITY_PHRASE, SITE_NAME, SITE_URL } from "./page-meta"; |
| 4 | import { ORGANIZATION_ID } from "./site-schema"; |
| 5 | |
| 6 | /** |
| 7 | * Structured product data for the release-backed install page. |
| 8 | * |
| 9 | * Source candidates deliberately do not enter this function: the download URL |
| 10 | * resolves published artifacts, so softwareVersion must describe that release |
| 11 | * or be absent when no published release receipt is available. |
| 12 | */ |
| 13 | export function buildSoftwareApplicationJsonLd( |
| 14 | publishedRelease: Pick<PublishedReleaseFact, "version"> | null, |
| 15 | ) { |
| 16 | return { |
| 17 | "@context": "https://schema.org", |
| 18 | "@type": "SoftwareApplication", |
| 19 | name: SITE_NAME, |
| 20 | url: SITE_URL, |
| 21 | description: IDENTITY_PHRASE, |
| 22 | applicationCategory: "DeveloperApplication", |
| 23 | operatingSystem: "macOS, Linux, Windows, Android", |
| 24 | ...(publishedRelease?.version ? { softwareVersion: publishedRelease.version } : {}), |
| 25 | license: `${REPO_URL}/blob/main/LICENSE`, |
| 26 | codeRepository: REPO_URL, |
| 27 | downloadUrl: `${SITE_URL}/en/install`, |
| 28 | author: { "@id": ORGANIZATION_ID }, |
| 29 | }; |
| 30 | } |
| 31 |