Files
DeepSeek-TUI/web/lib/faq-schema.ts
CodeWhale Bot 16e1af363e web: publish FAQ and organization structured data, llms.txt, and docs crumbs
The public FAQ now emits FAQPage JSON-LD from the same 40 Q&A pairs the
page renders. The locale layout carries a stable Organization/WebSite
graph so SoftwareApplication can reference it. /llms.txt is generated
from the docs registry; robots allows it; middleware does not
locale-prefix it. Docs pages get a Home → Docs → topic trail and a
matching BreadcrumbList.

Cloudflare Images is not enabled. Verified: 92 vitest files in the
touched web surface passed in the implementing session.
2026-08-18 21:14:07 -07:00

36 lines
741 B
TypeScript

import { flattenExtractedText } from "./react-text";
export interface FaqSchemaItem {
q: string;
a: React.ReactNode;
}
/**
* FAQPage structured data from the same Q&A pairs the FAQ page renders.
* `url` must be the canonical FAQ URL (en or zh), not a partial-locale fallback.
*/
export function buildFaqPageJsonLd({
items,
url,
inLanguage,
}: {
items: readonly FaqSchemaItem[];
url: string;
inLanguage: string;
}) {
return {
"@context": "https://schema.org",
"@type": "FAQPage",
url,
inLanguage,
mainEntity: items.map((item) => ({
"@type": "Question",
name: item.q,
acceptedAnswer: {
"@type": "Answer",
text: flattenExtractedText(item.a),
},
})),
};
}