The Open Standard for Generative UI
docs: branded OG images for every page, prerendered from page metadata (#1362)
devin-ai-integration[bot]06814a30dfa2
diff --git a/docs/.gitignore b/docs/.gitignoreindex 8a11fd9b8..d5787163e 100644--- a/docs/.gitignore+++ b/docs/.gitignore@@ -3,6 +3,7 @@# generated content.source+/generated/og-pages.ts# test & build/coveragediff --git a/docs/app/(home)/benchmarks/framework/metadata.ts b/docs/app/(home)/benchmarks/framework/metadata.tsnew file mode 100644index 000000000..732b1b42e--- /dev/null+++ b/docs/app/(home)/benchmarks/framework/metadata.ts@@ -0,0 +1,12 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/benchmarks/framework",+ title: "Generative UI framework benchmark | OpenUI",+ description:+ "Compare OpenUI, Google A2UI, and Vercel json-render across six models and 46 interface briefs, with exact server-rendered results and downloads.",+ openGraph: {+ title: "Framework benchmark",+ description: "OpenUI versus Google A2UI versus Vercel json-render under one condition.",+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/benchmarks/framework/page.tsx b/docs/app/(home)/benchmarks/framework/page.tsxindex f33fbfa99..bcb2f609a 100644--- a/docs/app/(home)/benchmarks/framework/page.tsx+++ b/docs/app/(home)/benchmarks/framework/page.tsx@@ -6,29 +6,20 @@ import {formatSummaryRows,} from "@/lib/benchmark-agent-data";import { BRIEFS, LINKS, MODELS, RUNS_PER_FORMAT, RUNS_TOTAL } from "@/lib/benchmark-data";-import type { Metadata } from "next";+import { createPageMetadata } from "@/lib/page-metadata";import { BenchmarkDetailPage } from "../BenchmarkDetailPage";+import page from "./metadata";-export const metadata: Metadata = {- title: "Generative UI framework benchmark | OpenUI",- description:- "Compare OpenUI, Google A2UI, and Vercel json-render across six models and 46 interface briefs, with exact server-rendered results and downloads.",+export const metadata = createPageMetadata(page, {alternates: {- canonical: "/benchmarks/framework",types: {"application/json": "/benchmarks/framework/data.json","text/csv": "/benchmarks/framework/data.csv","text/markdown": "/benchmarks/framework/agent.md",},},- openGraph: {- type: "article",- url: "/benchmarks/framework",- title: "Generative UI framework benchmark",- description: "OpenUI versus Google A2UI versus Vercel json-render under one condition.",- modifiedTime: BENCHMARK_UPDATED_ISO,- },-};+ openGraph: { type: "article", modifiedTime: BENCHMARK_UPDATED_ISO },+});const structuredData = {"@context": "https://schema.org",diff --git a/docs/app/(home)/benchmarks/language/metadata.ts b/docs/app/(home)/benchmarks/language/metadata.tsnew file mode 100644index 000000000..fbf86eedc--- /dev/null+++ b/docs/app/(home)/benchmarks/language/metadata.ts@@ -0,0 +1,12 @@+import { MODEL_BOARD_SIZE } from "@/lib/benchmark-data";+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/benchmarks/language",+ title: "OpenUI language and model benchmark | OpenUI",+ description: `Compare structural validity and measured cost across ${MODEL_BOARD_SIZE} models generating OpenUI, with exact server-rendered data and machine-readable downloads.`,+ openGraph: {+ title: "Language and model benchmark",+ description: `Structural validity and cost across ${MODEL_BOARD_SIZE} models generating OpenUI.`,+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/benchmarks/language/page.tsx b/docs/app/(home)/benchmarks/language/page.tsxindex 869c89691..63636b95c 100644--- a/docs/app/(home)/benchmarks/language/page.tsx+++ b/docs/app/(home)/benchmarks/language/page.tsx@@ -5,28 +5,20 @@ import {modelBoardRows,} from "@/lib/benchmark-agent-data";import { BRIEFS, MODEL_BOARD_SIZE } from "@/lib/benchmark-data";-import type { Metadata } from "next";+import { createPageMetadata } from "@/lib/page-metadata";import { BenchmarkDetailPage } from "../BenchmarkDetailPage";+import page from "./metadata";-export const metadata: Metadata = {- title: "OpenUI language and model benchmark | OpenUI",- description: `Compare structural validity and measured cost across ${MODEL_BOARD_SIZE} models generating OpenUI, with exact server-rendered data and machine-readable downloads.`,+export const metadata = createPageMetadata(page, {alternates: {- canonical: "/benchmarks/language",types: {"application/json": "/benchmarks/language/data.json","text/csv": "/benchmarks/language/data.csv","text/markdown": "/benchmarks/language/agent.md",},},- openGraph: {- type: "article",- url: "/benchmarks/language",- title: "OpenUI language and model benchmark",- description: `Structural validity and cost across ${MODEL_BOARD_SIZE} models generating OpenUI.`,- modifiedTime: MODEL_BOARD_UPDATED_ISO,- },-};+ openGraph: { type: "article", modifiedTime: MODEL_BOARD_UPDATED_ISO },+});const structuredData = {"@context": "https://schema.org",diff --git a/docs/app/(home)/benchmarks/metadata.ts b/docs/app/(home)/benchmarks/metadata.tsnew file mode 100644index 000000000..f5168dfc4--- /dev/null+++ b/docs/app/(home)/benchmarks/metadata.ts@@ -0,0 +1,15 @@+import { blankScreens, COST_MODELS, costPerPass, RUNS_PER_FORMAT } from "@/lib/benchmark-data";+import type { PageMetadataInput } from "@/lib/page-metadata";++const costRatios = COST_MODELS.flatMap((model) =>+ (["a2ui", "jsonRender"] as const).map(+ (format) => costPerPass[model]![format] / costPerPass[model]!.openui,+ ),+);++export default {+ pathname: "/benchmarks",+ title: { absolute: "Generative UI benchmark: OpenUI vs A2UI vs json-render | OpenUI" },+ description: `We generated the same 46 interfaces with 6 models in 3 generative UI formats: OpenUI, A2UI and json-render. OpenUI had the fewest blank screens (${blankScreens.openui} in ${RUNS_PER_FORMAT.toLocaleString("en-US")} runs), used about half the tokens, and cost ${Math.min(...costRatios).toFixed(1)} to ${Math.max(...costRatios).toFixed(1)}× less on every priced model.`,+ openGraph: { title: "Generative UI Benchmark" },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/benchmarks/methodology/metadata.ts b/docs/app/(home)/benchmarks/methodology/metadata.tsnew file mode 100644index 000000000..64ec9dcfb--- /dev/null+++ b/docs/app/(home)/benchmarks/methodology/metadata.ts@@ -0,0 +1,12 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/benchmarks/methodology",+ title: "Benchmark methodology | OpenUI",+ description:+ "How the OpenUI generative UI benchmark is run and scored: 46 briefs, 70 equivalent components, controlled generation settings, and SDK-native validation.",+ openGraph: {+ title: "Benchmark methodology",+ description: "A concise explanation of how the benchmark is generated and scored.",+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/benchmarks/methodology/page.tsx b/docs/app/(home)/benchmarks/methodology/page.tsxindex 1b1b54d78..dd148d387 100644--- a/docs/app/(home)/benchmarks/methodology/page.tsx+++ b/docs/app/(home)/benchmarks/methodology/page.tsx@@ -9,25 +9,16 @@ import {REPO_ROOT,RUNS_PER_FORMAT,} from "@/lib/benchmark-data";+import { createPageMetadata } from "@/lib/page-metadata";import { ArrowRight, ArrowUpRight } from "lucide-react";-import type { Metadata } from "next";import { BevelButton } from "../../components/Button/BevelButton";import { PillLink } from "../../components/Button/Button";import benchmarkStyles from "../benchmarks.module.css";+import page from "./metadata";-export const metadata: Metadata = {- title: "Benchmark methodology | OpenUI",- description:- "How the OpenUI generative UI benchmark is run and scored: 46 briefs, 70 equivalent components, controlled generation settings, and SDK-native validation.",- alternates: { canonical: "/benchmarks/methodology" },- openGraph: {- type: "article",- url: "/benchmarks/methodology",- title: "Generative UI benchmark methodology | OpenUI",- description: "A concise explanation of how the benchmark is generated and scored.",- modifiedTime: "2026-08-26",- },-};+export const metadata = createPageMetadata(page, {+ openGraph: { type: "article", modifiedTime: "2026-08-26" },+});const SECTIONS = [{ id: "setup", label: "Benchmark setup" },diff --git a/docs/app/(home)/benchmarks/page.tsx b/docs/app/(home)/benchmarks/page.tsxindex 06f762078..52e39983d 100644--- a/docs/app/(home)/benchmarks/page.tsx+++ b/docs/app/(home)/benchmarks/page.tsx@@ -8,34 +8,22 @@ import {} from "@/lib/benchmark-agent-data";import {BENCHMARK_VERSION,- blankScreens,- COST_MODELS,- costPerPass,LINKS,MODEL_BOARD_SIZE,RUNS_PER_FORMAT,tokens,} from "@/lib/benchmark-data";-import type { Metadata } from "next";+import { createPageMetadata } from "@/lib/page-metadata";import { Footer } from "../sections/Footer/Footer";import { BenchmarksContent } from "./BenchmarksContent";+import page from "./metadata";const { outputPerScreen } = tokens;const fewerTokensThan = (json: number) => Math.round((1 - outputPerScreen.openui / json) * 100);const TOKEN_ANSWER = `Use a compact UI language instead of JSON. Across ${RUNS_PER_FORMAT.toLocaleString("en-US")} runs per format on the same 46 interfaces, OpenUI Lang averaged ${outputPerScreen.openui.toLocaleString("en-US")} output tokens per screen, versus ${outputPerScreen.jsonRender.toLocaleString("en-US")} for json-render and ${outputPerScreen.a2ui.toLocaleString("en-US")} for A2UI, both JSON formats. That is ${fewerTokensThan(outputPerScreen.jsonRender)}% and ${fewerTokensThan(outputPerScreen.a2ui)}% fewer tokens, which lowers cost and shortens streaming time.`;-const costRatios = COST_MODELS.flatMap((model) =>- (["a2ui", "jsonRender"] as const).map(- (format) => costPerPass[model]![format] / costPerPass[model]!.openui,- ),-);-const INTRO = `We generated the same 46 interfaces with 6 models in 3 generative UI formats: OpenUI, A2UI and json-render. OpenUI had the fewest blank screens (${blankScreens.openui} in ${RUNS_PER_FORMAT.toLocaleString("en-US")} runs), used about half the tokens, and cost ${Math.min(...costRatios).toFixed(1)} to ${Math.max(...costRatios).toFixed(1)}× less on every priced model.`;--export const metadata: Metadata = {- title: { absolute: "Generative UI benchmark: OpenUI vs A2UI vs json-render | OpenUI" },- description: INTRO,+export const metadata = createPageMetadata(page, {alternates: {- canonical: "/benchmarks",types: {"application/json": "/benchmarks/data.json","application/schema+json": "/benchmarks/data.schema.json",@@ -43,19 +31,8 @@ export const metadata: Metadata = {"text/markdown": "/benchmarks/agent.md",},},- openGraph: {- type: "article",- url: "/benchmarks",- title: "Generative UI Benchmark | OpenUI",- description: INTRO,- modifiedTime: MODEL_BOARD_UPDATED_ISO,- },- twitter: {- card: "summary_large_image",- title: "Generative UI Benchmark | OpenUI",- description: INTRO,- },-};+ openGraph: { type: "article", modifiedTime: MODEL_BOARD_UPDATED_ISO },+});const structuredData = {"@context": "https://schema.org",diff --git a/docs/app/(home)/cloud/gateway/metadata.ts b/docs/app/(home)/cloud/gateway/metadata.tsnew file mode 100644index 000000000..0252dc595--- /dev/null+++ b/docs/app/(home)/cloud/gateway/metadata.ts@@ -0,0 +1,13 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/cloud/gateway",+ title: { absolute: "OpenUI Gateway | Production reliability for Generative UI" },+ description:+ "An OpenAI-compatible API that validates model output against your component library and repairs it as it streams.",+ openGraph: {+ title: "OpenUI Gateway | Production reliability for Generative UI",+ description:+ "Add production reliability to OpenUI with validation, streaming repair, model routing, and provider fallbacks through an OpenAI-compatible API.",+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/cloud/gateway/page.tsx b/docs/app/(home)/cloud/gateway/page.tsxindex e3c1ec9ec..a6295b77e 100644--- a/docs/app/(home)/cloud/gateway/page.tsx+++ b/docs/app/(home)/cloud/gateway/page.tsx@@ -1,5 +1,5 @@+import { createPageMetadata } from "@/lib/page-metadata";import { ArrowUpRight } from "lucide-react";-import type { Metadata } from "next";import { BevelButton } from "../../components/Button/BevelButton";import { FadedDither } from "../../components/FadedDither/FadedDither";import styles from "../../page.module.css";@@ -10,6 +10,7 @@ import { GatewayReliabilityOpenIllustration } from "../../sections/ProductIllustimport { CloudCtaSection } from "../CloudCtaSection";import { FaqSection } from "./FaqSection";import { IntegrateSection } from "./IntegrateSection";+import page from "./metadata";import gatewayStyles from "./page.module.css";import { PricingSection } from "./PricingSection";import { RepairSection } from "./RepairSection";@@ -18,19 +19,7 @@ import { SecuritySection } from "./SecuritySection";import { UsageSection } from "./UsageSection";import { WhySection } from "./WhySection";-export const metadata: Metadata = {- title: { absolute: "OpenUI Gateway | Production reliability for Generative UI" },- description:- "An OpenAI-compatible API that validates model output against your component library and repairs it as it streams.",- alternates: { canonical: "/cloud/gateway" },- openGraph: {- title: "OpenUI Gateway | Production reliability for Generative UI",- description:- "Add production reliability to OpenUI with validation, streaming repair, model routing, and provider fallbacks through an OpenAI-compatible API.",- url: "/cloud/gateway",- type: "website",- },-};+export const metadata = createPageMetadata(page);export default function GatewayPage() {return (diff --git a/docs/app/(home)/cloud/observability/metadata.ts b/docs/app/(home)/cloud/observability/metadata.tsnew file mode 100644index 000000000..a18e5ad28--- /dev/null+++ b/docs/app/(home)/cloud/observability/metadata.ts@@ -0,0 +1,7 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/cloud/observability",+ title: "OpenUI Observability - User analytics for AI agents",+ description: "See what users saw and did, where your agent fell short, and what to build next.",+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/cloud/observability/page.tsx b/docs/app/(home)/cloud/observability/page.tsxindex 76a18ef42..f4057d9bb 100644--- a/docs/app/(home)/cloud/observability/page.tsx+++ b/docs/app/(home)/cloud/observability/page.tsx@@ -1,6 +1,6 @@/* ssr entry: this page is a server component. */+import { createPageMetadata } from "@/lib/page-metadata";import { Gift } from "@phosphor-icons/react/dist/ssr";-import type { Metadata } from "next";import Image from "next/image";import { ExternalTextLink } from "../../components/ExternalTextLink/ExternalTextLink";import { FadedDither } from "../../components/FadedDither/FadedDither";@@ -14,6 +14,7 @@ import { EarlyAccessForm } from "./EarlyAccessForm";import { FaqSection } from "./FaqSection";import { FeaturesSection } from "./FeaturesSection";import { IntegrateSection } from "./IntegrateSection";+import page from "./metadata";import cloudStyles from "./page.module.css";import { WhySection } from "./WhySection";@@ -46,11 +47,7 @@ const TRUST_ITEMS: GridFeature[] = [},];-export const metadata: Metadata = {- title: "OpenUI Observability - User analytics for AI agents",- description: "See what users saw and did, where your agent fell short, and what to build next.",- alternates: { canonical: "/cloud/observability" },-};+export const metadata = createPageMetadata(page);/* A structural copy of the OpenUI Cloud page with its copy and artwork removed.Every section component beside this file is a local copy too, so editing onediff --git a/docs/app/(home)/integrations/[slug]/page.tsx b/docs/app/(home)/integrations/[slug]/page.tsxindex f04c66840..03c1b57ed 100644--- a/docs/app/(home)/integrations/[slug]/page.tsx+++ b/docs/app/(home)/integrations/[slug]/page.tsx@@ -1,4 +1,5 @@import { Footer } from "@/app/(home)/sections/Footer/Footer";+import { createPageMetadata } from "@/lib/page-metadata";import { ArrowLeft, ArrowRight, ArrowUpRight } from "lucide-react";import type { Metadata } from "next";import Link from "next/link";@@ -6,6 +7,7 @@ import { notFound } from "next/navigation";import { CopyCommand } from "../copy-command";import {getIntegrationCategory,+ getIntegrationPageMetadata,getRelatedIntegrations,integrationBySlug,integrations,@@ -26,17 +28,9 @@ export async function generateMetadata(props: {const integration = integrationBySlug.get(slug);if (!integration) notFound();- return {- title: { absolute: `${integration.seoTitle} | OpenUI` },- description: integration.summary,- alternates: { canonical: `/integrations/${integration.slug}` },- openGraph: {- title: `${integration.name} × OpenUI`,- description: integration.summary,- url: `/integrations/${integration.slug}`,- type: "article",- },- };+ return createPageMetadata(getIntegrationPageMetadata(integration), {+ openGraph: { type: "article" },+ });}export default async function IntegrationDetailPage(props: { params: Promise<{ slug: string }> }) {diff --git a/docs/app/(home)/integrations/data.ts b/docs/app/(home)/integrations/data.tsindex 02d2eb7a0..9f2bbe1c2 100644--- a/docs/app/(home)/integrations/data.ts+++ b/docs/app/(home)/integrations/data.ts@@ -1,3 +1,5 @@+import type { PageMetadataInput } from "@/lib/page-metadata";+export type IntegrationCategoryId = "ai-frameworks" | "design-systems" | "frontend-platforms";export interface IntegrationLink {@@ -871,3 +873,14 @@ export function getRelatedIntegrations(integration: Integration, limit = 3): Int.filter((item) => item.slug !== integration.slug).slice(0, limit);}++export function getIntegrationPageMetadata(integration: Integration): PageMetadataInput {+ return {+ pathname: `/integrations/${integration.slug}`,+ title: { absolute: `${integration.seoTitle} | OpenUI` },+ description: integration.summary,+ openGraph: { title: `${integration.name} × OpenUI` },+ // Remote logos are skipped so the build never fetches from third-party hosts.+ ogImage: { partnerLogo: integration.logo.startsWith("/") ? integration.logo : undefined },+ };+}diff --git a/docs/app/(home)/integrations/metadata.ts b/docs/app/(home)/integrations/metadata.tsnew file mode 100644index 000000000..206d6f864--- /dev/null+++ b/docs/app/(home)/integrations/metadata.ts@@ -0,0 +1,13 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/integrations",+ title: "Integrations",+ description:+ "Explore OpenUI integrations across AI frameworks and protocols, design systems, and frontend platforms.",+ openGraph: {+ title: "OpenUI integrations",+ description:+ "Build generative UI with the AI frameworks, design systems, and frontend platforms you know.",+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/integrations/page.tsx b/docs/app/(home)/integrations/page.tsxindex c1d2dc0b4..683e77cdb 100644--- a/docs/app/(home)/integrations/page.tsx+++ b/docs/app/(home)/integrations/page.tsx@@ -1,25 +1,14 @@import { PageHero } from "@/app/(home)/components/PageHero/PageHero";import { Footer } from "@/app/(home)/sections/Footer/Footer";+import { createPageMetadata } from "@/lib/page-metadata";import { ArrowRight, Boxes } from "lucide-react";-import type { Metadata } from "next";import Link from "next/link";import { getIntegrationsByCategory, integrationCategories } from "./data";import { IntegrationLogo } from "./integration-logo";+import page from "./metadata";import styles from "./page.module.css";-export const metadata: Metadata = {- title: "Integrations",- description:- "Explore OpenUI integrations across AI frameworks and protocols, design systems, and frontend platforms.",- alternates: { canonical: "/integrations" },- openGraph: {- title: "OpenUI integrations",- description:- "Build generative UI with the AI frameworks, design systems, and frontend platforms you know.",- url: "/integrations",- type: "website",- },-};+export const metadata = createPageMetadata(page);export default function IntegrationsPage() {return (diff --git a/docs/app/(home)/lab/metadata.ts b/docs/app/(home)/lab/metadata.tsnew file mode 100644index 000000000..417289d2f--- /dev/null+++ b/docs/app/(home)/lab/metadata.ts@@ -0,0 +1,11 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/lab",+ title: "OpenUI Lab",+ description: "Official and community projects built around OpenUI.",+ openGraph: {+ title: "OpenUI Lab",+ description: "Discover official and community projects built around OpenUI.",+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/lab/page.tsx b/docs/app/(home)/lab/page.tsxindex 41efe3e22..f21279805 100644--- a/docs/app/(home)/lab/page.tsx+++ b/docs/app/(home)/lab/page.tsx@@ -1,9 +1,10 @@import { labProjects } from "@/lib/lab-projects";+import { createPageMetadata } from "@/lib/page-metadata";import { ArrowUpRight, Plus } from "lucide-react";-import type { Metadata } from "next";import { BevelButton } from "../components/Button/BevelButton";import { PageHero, PageHeroAccent } from "../components/PageHero/PageHero";import { Footer } from "../sections/Footer/Footer";+import page from "./metadata";import styles from "./page.module.css";const TYPE_ACCENT: Record<string, "blue" | "green" | "purple" | "orange" | "slate"> = {@@ -20,22 +21,7 @@ const TYPE_ACCENT: Record<string, "blue" | "green" | "purple" | "orange" | "slatconst DISCORD_URL = "https://discord.gg/suzHfJnpw";-export const metadata: Metadata = {- title: "OpenUI Lab",- description: "Official and community projects built around OpenUI.",- alternates: { canonical: "/lab" },- openGraph: {- title: "OpenUI Lab",- description: "Discover official and community projects built around OpenUI.",- url: "/lab",- type: "website",- },- twitter: {- title: "OpenUI Lab",- description: "Discover official and community projects built around OpenUI.",- card: "summary_large_image",- },-};+export const metadata = createPageMetadata(page);function DiscordIcon({ className }: { className?: string }) {return (diff --git a/docs/app/(home)/openclaw-os/metadata.ts b/docs/app/(home)/openclaw-os/metadata.tsnew file mode 100644index 000000000..c1f94c41b--- /dev/null+++ b/docs/app/(home)/openclaw-os/metadata.ts@@ -0,0 +1,13 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/openclaw-os",+ title: "OpenClaw OS - The Default Workspace for OpenClaw",+ description:+ "OpenClaw OS is the default workspace for OpenClaw. Generate interactive apps and artifacts instantly for any use case, always updated with live data.",+ openGraph: {+ title: "OpenClaw OS",+ description:+ "The default workspace for OpenClaw. Generate interactive apps and artifacts instantly, always updated with live data.",+ },+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/openclaw-os/page.tsx b/docs/app/(home)/openclaw-os/page.tsxindex 3b65ca24b..90cffbf96 100644--- a/docs/app/(home)/openclaw-os/page.tsx+++ b/docs/app/(home)/openclaw-os/page.tsx@@ -1,36 +1,19 @@-import type { Metadata } from "next";-import { InstallSplitButton } from "./InstallSplitButton";-import { OpenClawFeatures } from "./OpenClawFeatures";+import { createPageMetadata } from "@/lib/page-metadata";import styles from "../page.module.css";import { Footer } from "../sections/Footer/Footer";import { HeroSection } from "../sections/HeroSection/HeroSection";import heroStyles from "../sections/HeroSection/HeroSection.module.css";import { PossibilitiesSection } from "../sections/PossibilitiesSection/PossibilitiesSection";import { StuckInChatSection } from "../sections/StuckInChatSection/StuckInChatSection";+import { InstallSplitButton } from "./InstallSplitButton";+import page from "./metadata";+import { OpenClawFeatures } from "./OpenClawFeatures";const INSTALL_COMMAND = "curl -fsSL https://openui.com/openclaw-os/install.sh | bash";const WINDOWS_INSTALL_COMMAND ='powershell -c "irm https://openui.com/openclaw-os/install.ps1 | iex"';-export const metadata: Metadata = {- title: "OpenClaw OS - The Default Workspace for OpenClaw",- description:- "OpenClaw OS is the default workspace for OpenClaw. Generate interactive apps and artifacts instantly for any use case, always updated with live data.",- alternates: { canonical: "/openclaw-os" },- openGraph: {- title: "OpenClaw OS — The Default Workspace for OpenClaw",- description:- "The default workspace for OpenClaw. Generate interactive apps and artifacts instantly, always updated with live data.",- url: "/openclaw-os",- type: "website",- },- twitter: {- title: "OpenClaw OS — The Default Workspace for OpenClaw",- description:- "The default workspace for OpenClaw. Generate interactive apps and artifacts instantly, always updated with live data.",- card: "summary_large_image",- },-};+export const metadata = createPageMetadata(page);export default function OpenClawOSPage() {return (@@ -53,10 +36,7 @@ export default function OpenClawOSPage() {}command={INSTALL_COMMAND}commandSlot={- <InstallSplitButton- macCommand={INSTALL_COMMAND}- winCommand={WINDOWS_INSTALL_COMMAND}- />+ <InstallSplitButton macCommand={INSTALL_COMMAND} winCommand={WINDOWS_INSTALL_COMMAND} />}align="left"desktopPreviewImage="/openclaw-os/hero-light.webp"diff --git a/docs/app/(home)/page.tsx b/docs/app/(home)/page.tsxindex 40f3b748f..dd0e2a4f4 100644--- a/docs/app/(home)/page.tsx+++ b/docs/app/(home)/page.tsx@@ -1,3 +1,4 @@+import { SITE_OPEN_GRAPH } from "@/lib/page-metadata";import { BASE_URL } from "@/lib/source";import type { Metadata } from "next";import { AGENT_SETUP_PROMPT, AgentPicker } from "./components/AgentPicker/AgentPicker";@@ -18,6 +19,7 @@ export const metadata: Metadata = {alternates: {canonical: "/",},+ openGraph: { ...SITE_OPEN_GRAPH, url: "/" },};const structuredData = {diff --git a/docs/app/(home)/pricing/metadata.ts b/docs/app/(home)/pricing/metadata.tsnew file mode 100644index 000000000..1ba1f07f6--- /dev/null+++ b/docs/app/(home)/pricing/metadata.ts@@ -0,0 +1,8 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/pricing",+ title: "OpenUI Pricing",+ description:+ "OpenUI is MIT licensed and free forever. Add OpenUI Gateway for production reliability and OpenUI Observability for agent product analytics.",+} satisfies PageMetadataInput;diff --git a/docs/app/(home)/pricing/page.tsx b/docs/app/(home)/pricing/page.tsxindex a6b577bf9..f069eb21c 100644--- a/docs/app/(home)/pricing/page.tsx+++ b/docs/app/(home)/pricing/page.tsx@@ -1,5 +1,5 @@+import { createPageMetadata } from "@/lib/page-metadata";import { ArrowRight } from "lucide-react";-import type { Metadata } from "next";import { GatewayPlans } from "../cloud/gateway/GatewayPlans";import heroStyles from "../cloud/gateway/page.module.css";import layout from "../cloud/gateway/sections.module.css";@@ -13,14 +13,10 @@ import {import { Footer } from "../sections/Footer/Footer";import { HeroSection } from "../sections/HeroSection/HeroSection";import { ProductLabel } from "../sections/ProductSection/ProductSection";+import page from "./metadata";import styles from "./page.module.css";-export const metadata: Metadata = {- title: "OpenUI Pricing",- description:- "OpenUI is MIT licensed and free forever. Add OpenUI Gateway for production reliability and OpenUI Observability for agent product analytics.",- alternates: { canonical: "/pricing" },-};+export const metadata = createPageMetadata(page);const BILLING_DETAILS: GridFeature[] = [{diff --git a/docs/app/blog/[slug]/page.tsx b/docs/app/blog/[slug]/page.tsxindex 01ab882ef..06e4bc49a 100644--- a/docs/app/blog/[slug]/page.tsx+++ b/docs/app/blog/[slug]/page.tsx@@ -1,5 +1,7 @@import { GitHubButton } from "@/app/(home)/components/GitHubButton/GitHubButton";import { Footer } from "@/app/(home)/sections/Footer/Footer";+import { blogOgImage } from "@/lib/og/content";+import { withOgImage } from "@/lib/page-metadata";import { blog } from "@/lib/source";import { getMDXComponents } from "@/mdx-components";import { TOCProvider, TOCScrollArea } from "fumadocs-ui/components/toc";@@ -68,13 +70,17 @@ export async function generateMetadata(props: {if (!page) notFound();- return {- title: page.data.seoTitle ? { absolute: `${page.data.seoTitle} | OpenUI` } : page.data.title,- description: page.data.description,- alternates: {- canonical: page.url,+ return withOgImage(+ {+ title: page.data.seoTitle ? { absolute: `${page.data.seoTitle} | OpenUI` } : page.data.title,+ description: page.data.description,+ alternates: {+ canonical: page.url,+ },},- };+ blogOgImage(page),+ { title: page.data.title, description: page.data.description },+ );}export function generateStaticParams(): { slug: string }[] {diff --git a/docs/app/blog/layout.tsx b/docs/app/blog/layout.tsxindex 184c4659a..a198dbf13 100644--- a/docs/app/blog/layout.tsx+++ b/docs/app/blog/layout.tsx@@ -1,12 +1,14 @@-import "../(home)/globals.css";import { WebsiteThemeProvider } from "@/components/website-theme-provider";+import { SITE_OPEN_GRAPH } from "@/lib/page-metadata";import type { Metadata } from "next";+import "../(home)/globals.css";import { BlogNavbar } from "./components/BlogNavbar";export const metadata: Metadata = {alternates: {canonical: "/blog",},+ openGraph: { ...SITE_OPEN_GRAPH, url: "/blog" },};export default function BlogLayout({ children }: { children: React.ReactNode }) {diff --git a/docs/app/chat/demo/[demoSlug]/page.tsx b/docs/app/chat/demo/[demoSlug]/page.tsxindex 7518160ed..6a0daf09e 100644--- a/docs/app/chat/demo/[demoSlug]/page.tsx+++ b/docs/app/chat/demo/[demoSlug]/page.tsx@@ -1,10 +1,11 @@-import { createPageMetadata } from "@/lib/page-metadata";+import { pageOgImage, withOgImage } from "@/lib/page-metadata";import { redirect } from "next/navigation";import {DEMO_CONVERSATIONS,getDemoConversationBySlug,getDemoConversationPath,} from "../../_components/demo-conversations";+import chat from "../../metadata";interface DemoChatPageProps {params: Promise<{ demoSlug: string }>;@@ -19,13 +20,16 @@ export async function generateMetadata({ params }: DemoChatPageProps) {const conversation = getDemoConversationBySlug(demoSlug);if (!conversation) return {};- return createPageMetadata({- pathname: getDemoConversationPath(conversation),- title: `${conversation.title} | OpenUI Cloud Chat`,- description: conversation.description,- image: "/nav/chat-light.webp",- imageAlt: `${conversation.title} demo preview`,- });+ // Link previews reuse the /chat card.+ return withOgImage(+ {+ title: `${conversation.title} | OpenUI Cloud Chat`,+ description: conversation.description,+ alternates: { canonical: getDemoConversationPath(conversation) },+ },+ pageOgImage(chat),+ { title: chat.title, description: chat.description },+ );}export default async function DemoChatPage({ params }: DemoChatPageProps) {diff --git a/docs/app/chat/metadata.ts b/docs/app/chat/metadata.tsnew file mode 100644index 000000000..ea3bd0f40--- /dev/null+++ b/docs/app/chat/metadata.ts@@ -0,0 +1,7 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/chat",+ title: "OpenUI Cloud Chat",+ description: "Explore OpenUI Cloud through live and curated generative UI conversations.",+} satisfies PageMetadataInput;diff --git a/docs/app/chat/page.tsx b/docs/app/chat/page.tsxindex 8a0a119ce..edb82f440 100644--- a/docs/app/chat/page.tsx+++ b/docs/app/chat/page.tsx@@ -1,12 +1,7 @@import { createPageMetadata } from "@/lib/page-metadata";+import page from "./metadata";-export const metadata = createPageMetadata({- pathname: "/chat",- title: "OpenUI Cloud Chat",- description: "Explore OpenUI Cloud through live and curated generative UI conversations.",- image: "/nav/chat-light.webp",- imageAlt: "OpenUI Chat preview",-});+export const metadata = createPageMetadata(page);export default function ChatPage() {return null;diff --git a/docs/app/compare/metadata.ts b/docs/app/compare/metadata.tsnew file mode 100644index 000000000..9f28963ec--- /dev/null+++ b/docs/app/compare/metadata.ts@@ -0,0 +1,8 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/compare",+ title: { absolute: "Generative UI vs Markdown responses: live comparison | OpenUI" },+ description: "Compare rendered Markdown, OpenUI OSS, and OpenUI Cloud side by side.",+ openGraph: { title: "Compare OpenUI" },+} satisfies PageMetadataInput;diff --git a/docs/app/compare/page.tsx b/docs/app/compare/page.tsxindex 886848574..48a2e49c8 100644--- a/docs/app/compare/page.tsx+++ b/docs/app/compare/page.tsx@@ -1,19 +1,9 @@import { createPageMetadata } from "@/lib/page-metadata";import { parseComparisonPair } from "./_components/chat-types";import { ComparePageClient } from "./_components/compare-page-client";+import page from "./metadata";-const TITLE = "Generative UI vs Markdown responses: live comparison | OpenUI";--export const metadata = {- ...createPageMetadata({- pathname: "/compare",- title: TITLE,- description: "Compare rendered Markdown, OpenUI OSS, and OpenUI Cloud side by side.",- image: "/nav/compare-light.webp",- imageAlt: "OpenUI comparison preview",- }),- title: { absolute: TITLE },-};+export const metadata = createPageMetadata(page);export default async function ComparePage(props: PageProps<"/compare">) {const searchParams = await props.searchParams;diff --git a/docs/app/components/layout.tsx b/docs/app/components/layout.tsxindex 40937c904..465a8477d 100644--- a/docs/app/components/layout.tsx+++ b/docs/app/components/layout.tsx@@ -1,14 +1,15 @@+import { createLayoutMetadata } from "@/lib/page-metadata";import AppThemeProvider from "@components/components/AppThemeProvider/AppThemeProvider";import ThemeToggle from "@components/components/ThemeToggle";import TopBarDocsButton from "@components/components/TopBarDocsButton/TopBarDocsButton";import TopNav from "@components/components/TopNav";import { TOP_NAV_ITEMS } from "@components/config/navigation";-import type { Metadata } from "next";import { Geist, Geist_Mono, Inter } from "next/font/google";import Link from "next/link";import type { ReactNode } from "react";import "./globals.css";import styles from "./layout.module.css";+import page from "./metadata";const inter = Inter({variable: "--font-inter",@@ -25,10 +26,7 @@ const geistMono = Geist_Mono({subsets: ["latin"],});-export const metadata: Metadata = {- title: "OpenUI Design System",- description: "Foundation, Blocks, and Compose documentation",-};+export const metadata = createLayoutMetadata(page);interface RootLayoutProps {children: ReactNode;diff --git a/docs/app/components/metadata.ts b/docs/app/components/metadata.tsnew file mode 100644index 000000000..d3065d1ea--- /dev/null+++ b/docs/app/components/metadata.ts@@ -0,0 +1,7 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/components",+ title: "OpenUI Design System",+ description: "Foundation, Blocks, and Compose documentation",+} satisfies PageMetadataInput;diff --git a/docs/app/debug/layout.tsx b/docs/app/debug/layout.tsxindex bce6746ee..6db9fcb91 100644--- a/docs/app/debug/layout.tsx+++ b/docs/app/debug/layout.tsx@@ -1,12 +1,9 @@import { WebsiteThemeProvider } from "@/components/website-theme-provider";-import type { Metadata } from "next";+import { createPageMetadata } from "@/lib/page-metadata";import type { ReactNode } from "react";+import page from "./metadata";-export const metadata: Metadata = {- title: "OpenUI Debug",- description:- "Try OpenUI Lang against any published @openuidev/lang-core version, replay it as a simulated LLM stream, and see what renders.",-};+export const metadata = createPageMetadata(page);export default function DebugLayout({ children }: { children: ReactNode }) {return <WebsiteThemeProvider>{children}</WebsiteThemeProvider>;diff --git a/docs/app/debug/metadata.ts b/docs/app/debug/metadata.tsnew file mode 100644index 000000000..e86d2ce1c--- /dev/null+++ b/docs/app/debug/metadata.ts@@ -0,0 +1,8 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/debug",+ title: "OpenUI Debug",+ description:+ "Try OpenUI Lang against any published @openuidev/lang-core version, replay it as a simulated LLM stream, and see what renders.",+} satisfies PageMetadataInput;diff --git a/docs/app/demo/github/layout.tsx b/docs/app/demo/github/layout.tsxindex 76adb44c1..9445e67cc 100644--- a/docs/app/demo/github/layout.tsx+++ b/docs/app/demo/github/layout.tsx@@ -2,14 +2,9 @@ import { WebsiteThemeProvider } from "@/components/website-theme-provider";import { createPageMetadata } from "@/lib/page-metadata";import type { ReactNode } from "react";import "./layout.css";+import page from "./metadata";-export const metadata = createPageMetadata({- pathname: "/demo/github",- title: "OpenUI GitHub Dashboard Demo",- description: "Generate interactive dashboards from live GitHub data with OpenUI.",- image: "/nav/dashboard-light.webp",- imageAlt: "OpenUI GitHub dashboard preview",-});+export const metadata = createPageMetadata(page);export default function DemoGitHubLayout({ children }: { children: ReactNode }) {return <WebsiteThemeProvider>{children}</WebsiteThemeProvider>;diff --git a/docs/app/demo/github/metadata.ts b/docs/app/demo/github/metadata.tsnew file mode 100644index 000000000..0b5003770--- /dev/null+++ b/docs/app/demo/github/metadata.ts@@ -0,0 +1,7 @@+import type { PageMetadataInput } from "@/lib/page-metadata";++export default {+ pathname: "/demo/github",+ title: "OpenUI GitHub Dashboard Demo",+ description: "Generate interactive dashboards from live GitHub data with OpenUI.",+} satisfies PageMetadataInput;diff --git a/docs/app/layout.tsx b/docs/app/layout.tsxindex 256b99f62..4b6b44f44 100644--- a/docs/app/layout.tsx+++ b/docs/app/layout.tsx@@ -2,6 +2,7 @@ import { RootProvider } from "fumadocs-ui/provider/next";import type { Metadata } from "next";import { Geist_Mono, Inter } from "next/font/google";import Script from "next/script";+import { SITE_NAME, SITE_OPEN_GRAPH } from "../lib/page-metadata";import { BASE_URL } from "../lib/source";import "./global.css";import { PHProvider } from "./providers";@@ -15,10 +16,9 @@ const geistMono = Geist_Mono({subsets: ["latin"],});-const SITE_TITLE = "OpenUI - The Open Standard for Intelligent UI";+const SITE_TITLE = SITE_NAME;const SITE_DESCRIPTION ="OpenUI is the open standard for Intelligent UI. Full-stack, framework-agnostic Generative UI built on OpenUI Lang, a streaming-first language with first-party runtimes for React, Vue, Svelte, and Angular, and up to 67% fewer tokens than JSON.";-const SITE_IMAGE = "/meta-image.png?v=20261008";export const metadata: Metadata = {metadataBase: new URL(BASE_URL),@@ -49,26 +49,9 @@ export const metadata: Metadata = {shortcut: "/shiro-logo.svg",apple: "/shiro-logo.svg",},- openGraph: {- type: "website",- url: "/",- siteName: SITE_TITLE,- title: SITE_TITLE,- description: SITE_DESCRIPTION,- images: [- {- url: SITE_IMAGE,- width: 1800,- height: 942,- alt: "OpenUI preview",- },- ],- },+ openGraph: SITE_OPEN_GRAPH,twitter: {card: "summary_large_image",- title: SITE_TITLE,- description: SITE_DESCRIPTION,- images: [SITE_IMAGE],},robots: {index: true,diff --git a/docs/app/og/[...path]/route.tsx b/docs/app/og/[...path]/route.tsxnew file mode 100644index 000000000..f6077d59e--- /dev/null+++ b/docs/app/og/[...path]/route.tsx@@ -0,0 +1,18 @@+import { getOgImages } from "@/lib/og/entries";+import { renderOgCard } from "@/lib/og/render";+import { notFound } from "next/navigation";++export const dynamic = "force-static";+export const dynamicParams = false;+export const revalidate = false;++export function generateStaticParams() {+ return [...getOgImages().keys()].map((path) => ({ path: path.slice(1).split("/") }));+}++export async function GET(_req: Request, { params }: RouteContext<"/og/[...path]">) {+ const { path } = await params;+ const image = getOgImages().get(`/${path.join("/")}`);+ if (!image) notFound();+ return renderOgCard(image.card);+}diff --git a/docs/app/og/docs/[...slug]/route.tsx b/docs/app/og/docs/[...slug]/route.tsxdeleted file mode 100644index 7e98c015e..000000000--- a/docs/app/og/docs/[...slug]/route.tsx+++ /dev/null@@ -1,28 +0,0 @@-import { getPageImage, source } from "@/lib/source";-import { ImageResponse } from "@takumi-rs/image-response";-import { generate as DefaultImage } from "fumadocs-ui/og/takumi";-import { notFound } from "next/navigation";--export const revalidate = false;--export async function GET(_req: Request, { params }: RouteContext<"/og/docs/[...slug]">) {- const { slug } = await params;- const page = source.getPage(slug.slice(0, -1));- if (!page) notFound();-- return new ImageResponse(- <DefaultImage title={page.data.title} description={page.data.description} site="OpenUI" />,- {- width: 1200,- height: 630,- format: "webp",- },- );-}--export function generateStaticParams() {- return source.getPages().map((page) => ({- lang: page.locale,- slug: getPageImage(page).segments,- }));-}diff --git a/docs/app/openui-vs-json/layout.tsx b/docs/app/openui-vs-json/layout.tsxindex c2bf897f6..be43c01fd 100644--- a/docs/app/openui-vs-json/layout.tsx+++ b/docs/app/openui-vs-json/layout.tsx@@ -2,18 +2,9 @@ import "@/app/demos/layout.css";import { WebsiteThemeProvider } from "@/components/website-theme-provider";import { createPageMetadata } from "@/lib/page-metadata";import type { ReactNode } from "react";-import { VS_JSON_SUMMARY, VS_JSON_TITLE } from "./summary";+import page from "./metadata";-export const metadata = {- ...createPageMetadata({- pathname: "/openui-vs-json",- title: VS_JSON_TITLE,- description: VS_JSON_SUMMARY,- image: "/nav/vsjson-light.webp",- imageAlt: "OpenUI versus JSON preview",- }),- title: { absolute: VS_JSON_TITLE },-};+export const metadata = createPageMetadata(page);export default function DemosLayout({ children }: { children: ReactNode }) {return <WebsiteThemeProvider>{children}</WebsiteThemeProvider>;diff --git a/docs/app/openui-vs-json/metadata.ts b/docs/app/openui-vs-json/metadata.tsnew file mode 100644index 000000000..ab98d0ed3--- /dev/null+++ b/docs/app/openui-vs-json/metadata.ts@@ -0,0 +1,9 @@+import type { PageMetadataInput } from "@/lib/page-metadata";+import { VS_JSON_SUMMARY, VS_JSON_TITLE } from "./summary";++export default {+ pathname: "/openui-vs-json",+ title: { absolute: VS_JSON_TITLE },+ description: VS_JSON_SUMMARY,+ openGraph: { title: "OpenUI vs JSON" },+} satisfies PageMetadataInput;diff --git a/docs/components/docs-page.tsx b/docs/components/docs-page.tsxindex c71b85737..460b1358e 100644--- a/docs/components/docs-page.tsx+++ b/docs/components/docs-page.tsx@@ -1,6 +1,8 @@import { LLMCopyButton, ViewOptions } from "@/components/ai/page-actions";import { gitConfig } from "@/lib/layout.shared";-import { getPageImage, source } from "@/lib/source";+import { docsOgImage } from "@/lib/og/content";+import { withOgImage } from "@/lib/page-metadata";+import { source } from "@/lib/source";import { getMDXComponents } from "@/mdx-components";import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/layouts/docs/page";import { createRelativeLink } from "fumadocs-ui/mdx";@@ -50,14 +52,17 @@ export function DocsPageView({ page }: { page: DocsSourcePage }) {}export function getDocsPageMetadata(page: DocsSourcePage): Metadata {+ const image = docsOgImage(page);+ const description = image.card.template === "card" ? image.card.description : undefined;+ return withOgImage({ ...docsMetadata(page), description }, image, { description });+}++function docsMetadata(page: DocsSourcePage): Metadata {return {title: page.data.title,description: page.data.description,alternates: {canonical: page.url,},- openGraph: {- images: getPageImage(page).url,- },};}diff --git a/docs/lib/og/content.ts b/docs/lib/og/content.tsnew file mode 100644index 000000000..b61773faf--- /dev/null+++ b/docs/lib/og/content.ts@@ -0,0 +1,40 @@+import type { InferPageType } from "fumadocs-core/source";+import { type blog, isTopLevelSection, source } from "../source";+import { type OgImage, publicFileExists } from "./images";++const DOCS_FALLBACK_DESCRIPTION = "Documentation for OpenUI, the open standard for Generative UI.";++function getSectionName(slugs: string[]) {+ const folder = source.pageTree.children.find(+ (node) => node.type === "folder" && node.$id === slugs[0],+ );+ return typeof folder?.name === "string" ? folder.name : undefined;+}++export function docsOgImage(page: InferPageType<typeof source>): OgImage {+ const section = getSectionName(page.slugs);+ return {+ path: page.url,+ card: {+ template: "card",+ eyebrow:+ isTopLevelSection(page.slugs) && section+ ? section+ : ["Docs", section].filter(Boolean).join(" / "),+ title: page.data.title,+ description: page.data.description ?? DOCS_FALLBACK_DESCRIPTION,+ },+ };+}++/** `ogImage` frontmatter, else the cover at `public/images/blog/<slug>.png`, else a text card. */+export function blogOgImage(page: InferPageType<typeof blog>): OgImage {+ const cover = page.data.ogImage ?? `/images/blog/${page.slugs[0]}.png`;+ const { title, author, description } = page.data;+ return {+ path: page.url,+ card: publicFileExists(cover)+ ? { template: "cover", cover, title, author }+ : { template: "card", eyebrow: `Blog · ${author}`, title, description },+ };+}diff --git a/docs/lib/og/entries.ts b/docs/lib/og/entries.tsnew file mode 100644index 000000000..3ceb11391--- /dev/null+++ b/docs/lib/og/entries.ts@@ -0,0 +1,34 @@+import { getIntegrationPageMetadata, integrations } from "@/app/(home)/integrations/data";+import { ogPages } from "@/generated/og-pages";+import { pageOgImage } from "../page-metadata";+import { blog, source } from "../source";+import { blogOgImage, docsOgImage } from "./content";+import type { OgImage } from "./images";++let images: Map<string, OgImage> | undefined;++/** Every prerendered OG image, keyed by page path. Throws on duplicate paths. */+export function getOgImages(): Map<string, OgImage> {+ if (images) return images;++ const all: OgImage[] = [];+ for (const [path, page] of Object.entries(ogPages)) {+ if (page.pathname !== path) {+ throw new Error(`metadata.ts for ${path} declares pathname ${page.pathname}`);+ }+ all.push(pageOgImage(page));+ }+ // Dynamic routes: one adapter per content collection.+ all.push(+ ...integrations.map((integration) => pageOgImage(getIntegrationPageMetadata(integration))),+ ...blog.getPages().map(blogOgImage),+ ...source.getPages().map(docsOgImage),+ );++ images = new Map();+ for (const image of all) {+ if (images.has(image.path)) throw new Error(`Duplicate OG image path: ${image.path}`);+ images.set(image.path, image);+ }+ return images;+}diff --git a/docs/lib/og/images.ts b/docs/lib/og/images.tsnew file mode 100644index 000000000..1c4700f57--- /dev/null+++ b/docs/lib/og/images.ts@@ -0,0 +1,50 @@+import { createHash } from "node:crypto";+import { existsSync, readFileSync } from "node:fs";+import { join } from "node:path";+import { OG_SIZE, type OgCardData, TEMPLATE_VERSION } from "./templates";++/** One prerendered OG image: the page it belongs to and what it shows. */+export type OgImage = { path: string; card: OgCardData };++export function publicPath(path: string) {+ return join(process.cwd(), "public", path);+}++export function publicFileExists(path: string) {+ return existsSync(publicPath(path));+}++function cardAssets(card: OgCardData) {+ const assets = ["/shiro-logo.svg"];+ if (card.template === "cover") assets.push(card.cover);+ else if (card.partnerLogo) assets.push(card.partnerLogo);+ return assets;+}++/**+ * `/og/<page path>?v=<hash>`. The hash covers the card content, the artwork bytes, and+ * `TEMPLATE_VERSION`, so link-preview caches refetch whenever the rendered image would change.+ * The route ignores the query string.+ */+export function ogImageUrl({ path, card }: OgImage) {+ const hash = createHash("sha256").update(`${TEMPLATE_VERSION}\n${JSON.stringify(card)}`);+ for (const asset of cardAssets(card)) hash.update(readFileSync(publicPath(asset)));+ return `/og${path}?v=${hash.digest("hex").slice(0, 10)}`;+}++/**+ * Blog covers are photographic, so they ship as JPEG to stay small (WhatsApp drops previews for+ * large images). Text cards stay PNG for crisp type.+ */+export function ogImageFormat(card: OgCardData) {+ return card.template === "cover" ? "jpeg" : "png";+}++export function ogImageMetadata(image: OgImage) {+ return {+ url: ogImageUrl(image),+ ...OG_SIZE,+ type: `image/${ogImageFormat(image.card)}`,+ alt: image.card.title,+ };+}diff --git a/docs/lib/og/render.tsx b/docs/lib/og/render.tsxnew file mode 100644index 000000000..579bb8a3d--- /dev/null+++ b/docs/lib/og/render.tsx@@ -0,0 +1,65 @@+import { ImageResponse } from "@takumi-rs/image-response";+import { readFile } from "node:fs/promises";+import { extname, join } from "node:path";+import { ogImageFormat } from "./images";+import { OG_SIZE, OgCard, type OgCardData, OgCover } from "./templates";++let fonts: Promise<{ name: string; weight: number; data: Buffer }[]> | undefined;++function loadFonts() {+ fonts ??= Promise.all(+ [400, 500, 600].map(async (weight) => ({+ name: "Inter",+ weight,+ data: await readFile(+ join(+ process.cwd(),+ "node_modules/@fontsource/inter/files",+ `inter-latin-${weight}-normal.woff2`,+ ),+ ),+ })),+ );+ return fonts;+}++const MIME_TYPES: Record<string, string> = {+ ".png": "image/png",+ ".jpg": "image/jpeg",+ ".jpeg": "image/jpeg",+ ".webp": "image/webp",+ ".svg": "image/svg+xml",+};++/** Reads a file from `public/` as a data URI. */+async function publicImage(path: string): Promise<string> {+ const data = await readFile(join(process.cwd(), "public", path));+ return `data:${MIME_TYPES[extname(path)]};base64,${data.toString("base64")}`;+}++export async function renderOgCard(card: OgCardData) {+ const logo = await publicImage("/shiro-logo.svg");+ const node =+ card.template === "cover" ? (+ <OgCover+ src={await publicImage(card.cover)}+ logo={logo}+ title={card.title}+ author={card.author}+ />+ ) : (+ <OgCard+ logo={logo}+ eyebrow={card.eyebrow}+ title={card.title}+ description={card.description}+ partnerLogo={card.partnerLogo && (await publicImage(card.partnerLogo))}+ />+ );+ return new ImageResponse(node, {+ ...OG_SIZE,+ format: ogImageFormat(card),+ quality: 85,+ fonts: await loadFonts(),+ });+}diff --git a/docs/lib/og/templates.tsx b/docs/lib/og/templates.tsxnew file mode 100644index 000000000..04f2e87ec--- /dev/null+++ b/docs/lib/og/templates.tsx@@ -0,0 +1,206 @@+/**+ * Layouts for every OG image on the site. Each image is a 1200×630 PNG, prerendered by+ * `app/og/[...path]/route.tsx` from an `OgCardData` description.+ *+ * Renders with Takumi, which supports a subset of CSS: every element with children needs+ * `display: "flex"`, and images must be data URIs (see `publicImage` in `./render`).+ */++/**+ * Part of every OG image URL's `?v=` hash, so link-preview caches refetch after a design change.+ * Bump this whenever you change anything in this file that affects the rendered output.+ */+export const TEMPLATE_VERSION = 1;++export const OG_SIZE = { width: 1200, height: 630 };++/** What one OG image shows. Asset paths are relative to `public/`. */+export type OgCardData =+ | {+ template: "card";+ title: string;+ description?: string;+ /** Small label in the top right, e.g. the docs section. */+ eyebrow?: string;+ /** Shown as `partnerLogo × OpenUI` above the title. */+ partnerLogo?: string;+ }+ | {+ template: "cover";+ /** Blog cover art, cropped to fill the top of the image. */+ cover: string;+ title: string;+ author?: string;+ };++const COLORS = {+ background: "#ffffff",+ primary: "#0a0a0a",+ secondary: "#8a8a8a",+ hairline: "rgba(0, 0, 0, 0.09)",+};++type OgCardProps = {+ logo: string;+ eyebrow?: string;+ title: string;+ description?: string;+ partnerLogo?: string;+};++/**+ * Text card used by docs, marketing pages, integrations, and blog posts without a cover.+ * The OpenUI mark sits top left, and the title and description sit at the bottom. Both are+ * clamped to two lines so long metadata never overflows.+ */+export function OgCard({ logo, eyebrow, title, description, partnerLogo }: OgCardProps) {+ return (+ <div+ style={{+ display: "flex",+ flexDirection: "column",+ width: "100%",+ height: "100%",+ padding: "64px 72px",+ backgroundColor: COLORS.background,+ fontFamily: "Inter",+ color: COLORS.primary,+ }}+ >+ <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>+ <div style={{ display: "flex", alignItems: "center", gap: 14 }}>+ <img alt="" src={logo} width={46} height={44} />+ <span style={{ fontSize: 32, fontWeight: 600, letterSpacing: "-0.02em" }}>OpenUI</span>+ </div>+ {eyebrow && (+ <span style={{ fontSize: 26, fontWeight: 500, color: COLORS.secondary }}>{eyebrow}</span>+ )}+ </div>++ {/* `marginTop: auto` pushes the text block to the bottom edge. */}+ <div style={{ display: "flex", flexDirection: "column", marginTop: "auto", gap: 20 }}>+ {partnerLogo && (+ <div style={{ display: "flex", alignItems: "center", gap: 20, marginBottom: 16 }}>+ <img alt="" src={partnerLogo} width={72} height={72} style={{ objectFit: "contain" }} />+ <span style={{ fontSize: 40, color: COLORS.secondary }}>×</span>+ <img alt="" src={logo} width={76} height={72} />+ </div>+ )}+ <span+ style={{+ fontSize: 76,+ fontWeight: 600,+ lineHeight: 1.08,+ letterSpacing: "-0.03em",+ lineClamp: 2,+ textOverflow: "ellipsis",+ }}+ >+ {title}+ </span>+ {description && (+ <span+ style={{+ fontSize: 34,+ lineHeight: 1.3,+ letterSpacing: "-0.01em",+ color: COLORS.secondary,+ lineClamp: 2,+ textOverflow: "ellipsis",+ }}+ >+ {description}+ </span>+ )}+ </div>+ </div>+ );+}++/**+ * Height of the cover art. The art fills the top of the image, and the title sits on the dark+ * band below it, so text never overlaps the centered artwork most covers have.+ */+const COVER_HEIGHT = 460;++type OgCoverProps = { src: string; logo: string; title: string; author?: string };++/** Blog post with a cover: cover art on top, title and author on a dark band, OpenUI pill top left. */+export function OgCover({ src, logo, title, author }: OgCoverProps) {+ return (+ <div+ style={{+ display: "flex",+ position: "relative",+ ...OG_SIZE,+ backgroundColor: COLORS.primary,+ fontFamily: "Inter",+ }}+ >+ {/* `objectFit: cover` center-crops covers of any aspect ratio. */}+ <img+ alt=""+ src={src}+ style={{+ position: "absolute",+ top: 0,+ left: 0,+ width: OG_SIZE.width,+ height: COVER_HEIGHT,+ objectFit: "cover",+ }}+ />+ {/* Overlay: fades the bottom of the cover into the band that holds the title. */}+ <div+ style={{+ display: "flex",+ flexDirection: "column",+ justifyContent: "space-between",+ position: "absolute",+ top: 0,+ left: 0,+ ...OG_SIZE,+ padding: "48px 64px 56px",+ backgroundImage:+ "linear-gradient(to bottom, rgba(10, 10, 10, 0) 45%, rgb(10, 10, 10) 68%)",+ }}+ >+ {/* The white pill keeps the mark legible on any cover. */}+ <div+ style={{+ display: "flex",+ alignItems: "center",+ alignSelf: "flex-start",+ gap: 12,+ padding: "10px 20px 10px 14px",+ borderRadius: 999,+ backgroundColor: COLORS.background,+ color: COLORS.primary,+ }}+ >+ <img alt="" src={logo} width={38} height={36} />+ <span style={{ fontSize: 28, fontWeight: 600, letterSpacing: "-0.02em" }}>OpenUI</span>+ </div>+ <div style={{ display: "flex", flexDirection: "column", gap: 12, color: "#ffffff" }}>+ <span+ style={{+ fontSize: 56,+ fontWeight: 600,+ lineHeight: 1.08,+ letterSpacing: "-0.03em",+ lineClamp: 2,+ textOverflow: "ellipsis",+ }}+ >+ {title}+ </span>+ {author && (+ <span style={{ fontSize: 28, fontWeight: 500, color: "rgba(255, 255, 255, 0.75)" }}>+ {author}+ </span>+ )}+ </div>+ </div>+ </div>+ );+}diff --git a/docs/lib/page-metadata.ts b/docs/lib/page-metadata.tsindex b5efee68c..9affd51da 100644--- a/docs/lib/page-metadata.ts+++ b/docs/lib/page-metadata.ts@@ -1,45 +1,96 @@import type { Metadata } from "next";+import { type OgImage, ogImageMetadata } from "./og/images";-type PageMetadataOptions = {+export const SITE_NAME = "OpenUI - The Open Standard for Intelligent UI";++/** Site-wide card, used by the homepage and the blog index. */+export const SITE_OPEN_GRAPH = {+ type: "website",+ siteName: SITE_NAME,+ images: [+ {+ url: "/meta-image.png?v=20261008",+ type: "image/png",+ width: 1800,+ height: 942,+ alt: "OpenUI preview",+ },+ ],+} satisfies Metadata["openGraph"];++/**+ * A page's title, description, and OG artwork, declared once. Static routes keep this in a+ * colocated `metadata.ts` (picked up by `scripts/generate-og-map.mjs`); dynamic routes build it+ * from their content and register it in `lib/og/entries.ts`.+ */+export type PageMetadataInput = {pathname: string;- title: string;+ title: string | { absolute: string };description: string;- image: string;- imageAlt: string;+ /** Link-preview title and description, when they differ from the page's. */+ openGraph?: { title?: string; description?: string };+ ogImage?: { eyebrow?: string; partnerLogo?: string };};-export function createPageMetadata({- pathname,- title,- description,- image,- imageAlt,-}: PageMetadataOptions): Metadata {+export function pageOgImage(page: PageMetadataInput): OgImage {return {- title,- description,- alternates: {- canonical: pathname,+ path: page.pathname,+ card: {+ template: "card",+ title:+ page.openGraph?.title ??+ (typeof page.title === "string" ? page.title : page.title.absolute),+ description: page.openGraph?.description ?? page.description,+ ...page.ogImage,+ },+ };+}++/** Builds Next metadata with the page's OG image. `extra` adds fields such as `alternates.types`. */+export function createPageMetadata(page: PageMetadataInput, extra: Metadata = {}): Metadata {+ const image = pageOgImage(page);+ return withOgImage(+ {+ ...extra,+ title: page.title,+ description: page.description,+ alternates: { canonical: page.pathname, ...extra.alternates },+ openGraph: { url: page.pathname, ...extra.openGraph } as Metadata["openGraph"],},+ image,+ { title: image.card.title, description: page.openGraph?.description ?? page.description },+ );+}++/** For layouts whose child pages inherit the metadata: no canonical or `og:url`. */+export function createLayoutMetadata(page: PageMetadataInput): Metadata {+ const image = pageOgImage(page);+ return withOgImage({ title: page.title, description: page.description }, image, {+ title: image.card.title,+ description: page.openGraph?.description ?? page.description,+ });+}++/**+ * Sets the same OG image on Open Graph and Twitter. `preview` is the link-preview title and+ * description; when omitted, Next falls back to the page's `title` and `description`.+ */+export function withOgImage(+ metadata: Metadata,+ image: OgImage,+ preview: PageMetadataInput["openGraph"] = {},+): Metadata {+ const images = [ogImageMetadata(image)];+ return {+ ...metadata,openGraph: {- title,- description,- url: pathname,+ siteName: SITE_NAME,type: "website",- images: [- {- url: image,- width: 560,- height: 320,- alt: imageAlt,- },- ],- },- twitter: {- card: "summary_large_image",- title,- description,- images: [image],- },+ url: metadata.alternates?.canonical ?? image.path,+ ...metadata.openGraph,+ ...preview,+ images,+ } as Metadata["openGraph"],+ twitter: { card: "summary_large_image", ...metadata.twitter, ...preview, images },};}diff --git a/docs/lib/source.ts b/docs/lib/source.tsindex 4eefa3db5..0d1ac8096 100644--- a/docs/lib/source.ts+++ b/docs/lib/source.ts@@ -25,15 +25,6 @@ export const blog = loader({source: toFumadocsSource(blogPosts, []),});-export function getPageImage(page: InferPageType<typeof source>) {- const segments = [...page.slugs, "image.webp"];-- return {- segments,- url: `/og/docs/${segments.join("/")}`,- };-}-export async function getLLMText(page: InferPageType<typeof source>) {const processed = await page.data.getText("processed");const description = page.data.description || `OpenUI documentation for ${page.data.title}.`;diff --git a/docs/next.config.mjs b/docs/next.config.mjsindex 0819021cf..07e19d37a 100644--- a/docs/next.config.mjs+++ b/docs/next.config.mjs@@ -9,6 +9,11 @@ const withMDX = createMDX();/** @type {import('next').NextConfig} */const config = {serverExternalPackages: ["@takumi-rs/image-response"],+ // OG metadata and images read artwork from public/ by path, so tracing would otherwise+ // bundle every video into each function. Media is served from the CDN, never read at runtime.+ outputFileTracingExcludes: {+ "/**": ["./public/**/*.{mp4,webm,mov,gif}"],+ },images: {/* Dense product screenshots contain small UI text and one-pixel rules.Keep the default for general imagery, but allow the illustration pairdiff --git a/docs/package.json b/docs/package.jsonindex 044bc98b9..048bf6b35 100644--- a/docs/package.json+++ b/docs/package.json@@ -5,11 +5,11 @@"scripts": {"generate:prompts": "pnpm --filter @openuidev/cli build && pnpm exec openui generate lib/chat-library.ts --spec --out generated/chat-library.spec.json && pnpm exec openui generate lib/playground-library.ts --spec --out generated/playground-library.spec.json","fetch:tweets": "node scripts/fetch-static-tweets.mjs",- "build": "next build --no-mangling",- "dev": "pnpm generate:prompts && next dev",+ "build": "node scripts/generate-og-map.mjs && next build --no-mangling",+ "dev": "pnpm generate:prompts && node scripts/generate-og-map.mjs && { node scripts/generate-og-map.mjs --watch & next dev; }","start": "next start",- "types:check": "fumadocs-mdx && next typegen && tsc --noEmit",- "postinstall": "fumadocs-mdx",+ "types:check": "fumadocs-mdx && node scripts/generate-og-map.mjs && next typegen && tsc --noEmit",+ "postinstall": "fumadocs-mdx && node scripts/generate-og-map.mjs","lint": "eslint","format:fix": "prettier --write .","format:check": "prettier --check .",@@ -21,6 +21,7 @@"@codemirror/language": "^6.12.4","@codemirror/state": "^6.7.1","@codemirror/view": "^6.43.6",+ "@fontsource/inter": "5.3.0","@openuidev/cli": "workspace:*","@openuidev/lang-core": "workspace:^","@openuidev/react-headless": "workspace:^",diff --git a/docs/scripts/generate-og-map.mjs b/docs/scripts/generate-og-map.mjsnew file mode 100644index 000000000..ecde4b77e--- /dev/null+++ b/docs/scripts/generate-og-map.mjs@@ -0,0 +1,81 @@+// Finds every colocated `app/**/metadata.ts` and writes `generated/og-pages.ts`, a static import map+// keyed by public pathname. `app/og/[...path]/route.tsx` prerenders one OG image per entry.+//+// Usage: node scripts/generate-og-map.mjs [--watch]+import { existsSync, readdirSync, readFileSync, watch, writeFileSync } from "node:fs";+import { basename, dirname, join, relative, sep } from "node:path";+import { fileURLToPath } from "node:url";++const root = join(dirname(fileURLToPath(import.meta.url)), "..");+const appDir = join(root, "app");+const outFile = join(root, "generated", "og-pages.ts");++function routePath(dir) {+ const segments = relative(appDir, dir).split(sep).filter(Boolean);+ const path = [];+ for (const segment of segments) {+ if (segment.startsWith("(") && segment.endsWith(")")) continue;+ if (/^[[@_]/.test(segment)) {+ throw new Error(+ `${relative(root, dir)}/metadata.ts: metadata.ts is only for static routes. ` ++ `Dynamic routes get OG images from an adapter in lib/og/entries.ts.`,+ );+ }+ path.push(segment);+ }+ return `/${path.join("/")}`;+}++function generate() {+ const pages = new Map();+ for (const file of readdirSync(appDir, { recursive: true })) {+ if (basename(file) !== "metadata.ts") continue;+ const dir = dirname(join(appDir, file));+ const path = routePath(dir);+ const existing = pages.get(path);+ if (existing) {+ throw new Error(`Duplicate OG page path ${path}: ${existing} and ${relative(root, dir)}`);+ }+ pages.set(path, relative(root, dir));+ }++ const entries = [...pages].sort(([a], [b]) => (a < b ? -1 : 1));+ const source = [+ "// Generated by scripts/generate-og-map.mjs. Do not edit.",+ 'import type { PageMetadataInput } from "@/lib/page-metadata";',+ ...entries.map(+ ([, dir], i) => `import page${i} from "../${dir.split(sep).join("/")}/metadata";`,+ ),+ "",+ "export const ogPages: Record<string, PageMetadataInput> = {",+ ...entries.map(([path], i) => ` ${JSON.stringify(path)}: page${i},`),+ "};",+ "",+ ].join("\n");++ // Only write on change so `next dev` doesn't recompile on every run.+ if (!existsSync(outFile) || readFileSync(outFile, "utf8") !== source) {+ writeFileSync(outFile, source);+ console.log(`og-map: wrote ${entries.length} pages to ${relative(root, outFile)}`);+ }+}++generate();++if (process.argv.includes("--watch")) {+ let timer;+ watch(appDir, { recursive: true }, (_event, file) => {+ if (!file || basename(file) !== "metadata.ts") return;+ clearTimeout(timer);+ timer = setTimeout(() => {+ try {+ generate();+ } catch (error) {+ console.error(`og-map: ${error.message}`);+ }+ }, 100);+ });+ // Runs in the background next to `next dev`; exit once that shell is gone.+ const parent = process.ppid;+ setInterval(() => process.ppid !== parent && process.exit(0), 1000);+}diff --git a/docs/source.config.ts b/docs/source.config.tsindex 4fcc06e59..fde082104 100644--- a/docs/source.config.ts+++ b/docs/source.config.ts@@ -37,6 +37,8 @@ export const blogPosts = defineCollections({author: z.string(),date: z.string().date().or(z.date()),featured: z.boolean().optional(),+ /** Social preview image in `public/`, used instead of the cropped cover. */+ ogImage: z.string().optional(),}),});diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex adb631dc3..57a2f2a10 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -150,6 +150,9 @@ importers:'@codemirror/view':specifier: ^6.43.6version: 6.43.8+ '@fontsource/inter':+ specifier: 5.3.0+ version: 5.3.0'@openuidev/cli':specifier: workspace:*version: link:../packages/openui-cli@@ -1956,6 +1959,9 @@ packages:'@floating-ui/[email protected]':resolution: {integrity: sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==}+ '@fontsource/[email protected]':+ resolution: {integrity: sha512-RofMylZmjlJEfELXeNHFWBRcSs75rGU/6bV2S2jfnvv/3rPXPGe0LgUJTklcHZ9lM4OZmAVFhcJPnACfb91A3g==}+'@fumadocs/[email protected]':resolution: {integrity: sha512-ENKPWUDRmriccsrUDE4bDBq3FNr/ms3BP2rWlsAEMV1yP23pcCaan+ceGfeBUsAQjw7sj9Q3R4Kl3g/TCStPzQ==}peerDependencies:@@ -12190,6 +12196,8 @@ snapshots:'@floating-ui/[email protected]': {}+ '@fontsource/[email protected]': {}+optionalDependencies:'@tailwindcss/oxide': 4.3.3