From c050bfb905db7e83f24e326d0c242d8b04092189 Mon Sep 17 00:00:00 2001 From: Jack Zhuang Date: Wed, 26 Aug 2026 03:31:15 +0800 Subject: [PATCH 1/2] feat(docs): emit JSON-LD on the homepage, doc pages and blog posts Adds a schema.org @graph to the three served page shapes, built from the same page data generateMetadata() already reads. Co-Authored-By: Claude Opus 5 --- .../docs/app/[lang]/blog/[[...slug]]/page.tsx | 67 +++++++- .../docs/app/[lang]/docs/[[...slug]]/page.tsx | 111 +++++++++++++ apps/docs/app/[lang]/page.tsx | 55 ++++++- apps/docs/lib/structured-data.tsx | 154 ++++++++++++++++++ 4 files changed, 385 insertions(+), 2 deletions(-) create mode 100644 apps/docs/lib/structured-data.tsx diff --git a/apps/docs/app/[lang]/blog/[[...slug]]/page.tsx b/apps/docs/app/[lang]/blog/[[...slug]]/page.tsx index b66ed759cf..09591b45ba 100644 --- a/apps/docs/app/[lang]/blog/[[...slug]]/page.tsx +++ b/apps/docs/app/[lang]/blog/[[...slug]]/page.tsx @@ -5,6 +5,14 @@ import { getMDXComponents } from '@/mdx-components'; import { HomeLayout } from 'fumadocs-ui/layouts/home'; import { baseOptions } from '@/lib/layout.shared'; import { absoluteUrl } from '@/lib/site'; +import { + compact, + JsonLd, + type JsonLdNode, + ORGANIZATION, + ORGANIZATION_REF, + sitemapLastModified, +} from '@/lib/structured-data'; import Link from 'next/link'; import { ArrowLeft } from 'lucide-react'; @@ -20,6 +28,62 @@ interface BlogPostData { const components = getMDXComponents() as any; +/** + * `frontmatter.date` as an ISO 8601 instant, or `undefined`. + * + * ⚠️ The value arriving here is **not** the `2026-07-17` written in the MDX. YAML + * parses an unquoted date into a `Date`, and `source.config.ts` declares the field + * as `z.coerce.string()`, so what reaches this component is that `Date` run through + * `String()` — a locale-and-timezone-dependent spelling. The page renders it + * unchanged into `