The Open Framework for Building Agents
feat(docs): add static OG image for home and docs (#33)
christopherkindl31d9378b9ffb
diff --git a/apps/docs/app/[lang]/(home)/page.tsx b/apps/docs/app/[lang]/(home)/page.tsxindex 9378f5ece..5cb821455 100644--- a/apps/docs/app/[lang]/(home)/page.tsx+++ b/apps/docs/app/[lang]/(home)/page.tsx@@ -1,6 +1,7 @@import type { Metadata } from "next";import Link from "next/link";import { Installer } from "@/components/geistdocs/installer";+import { staticOgImage } from "@/lib/geistdocs/og";import { ArchitectureDiagram } from "./components/architecture";import { CTA } from "./components/cta";import { FeatureGrid } from "./components/feature-grid";@@ -15,6 +16,17 @@ const betaAgreementHref = "https://vercel.com/docs/release-phases/public-beta-agexport const metadata: Metadata = {title,description: `${tagline} ${description}`,+ openGraph: {+ title,+ description: `${tagline} ${description}`,+ images: [staticOgImage],+ },+ twitter: {+ card: "summary_large_image",+ title,+ description: `${tagline} ${description}`,+ images: [staticOgImage],+ },};const HomePage = () => (diff --git a/apps/docs/app/[lang]/docs/[[...slug]]/page.tsx b/apps/docs/app/[lang]/docs/[[...slug]]/page.tsxindex bd13c7524..ef5972387 100644--- a/apps/docs/app/[lang]/docs/[[...slug]]/page.tsx+++ b/apps/docs/app/[lang]/docs/[[...slug]]/page.tsx@@ -3,6 +3,7 @@ import { createDocsPage } from "@vercel/geistdocs/pages/docs";import type { MDXComponents } from "mdx/types";import { getMDXComponents } from "@/components/geistdocs/mdx-components";import { config } from "@/lib/geistdocs/config";+import { staticOgImage } from "@/lib/geistdocs/og";import { geistdocsSource } from "@/lib/geistdocs/source";import { getSiteOrigin } from "@/lib/geistdocs/url";@@ -12,12 +13,15 @@ const docsPage = createDocsPage({const components: MDXComponents = link ? { a: link } : {};return getMDXComponents(components);},- metadata: ({ metadata, page }) => ({+ metadata: ({ metadata }) => ({...metadata,metadataBase: new URL(getSiteOrigin()),openGraph: {...metadata.openGraph,- images: geistdocsSource.getPageImage(page).url,+ // Override with the static OG image for now. To restore dynamic per-page+ // OG generation, add `page` back to the destructure above and swap the+ // line below back to: images: geistdocsSource.getPageImage(page).url,+ images: [staticOgImage],},}),source: geistdocsSource,diff --git a/apps/docs/lib/geistdocs/og.ts b/apps/docs/lib/geistdocs/og.tsnew file mode 100644index 000000000..05da1347b--- /dev/null+++ b/apps/docs/lib/geistdocs/og.ts@@ -0,0 +1,4 @@+// Shared static OG image used across the site for now.+// TODO: restore the dynamic per-page OG generation in+// app/[lang]/docs/[[...slug]]/page.tsx when ready.+export const staticOgImage = "https://ztwjwi3ssdvgx15d.public.blob.vercel-storage.com/og-image.jpg";