From 89930014710bf5337183ca4b656d0fcf3cb4017b Mon Sep 17 00:00:00 2001 From: Kody Jackson Date: Tue, 20 Oct 2026 08:39:33 -0500 Subject: [PATCH] feat(kb) - add structured ld+json data to KB pages (#51498) ## Problem Follow up to #51497 and #51496, but for KB. Currently the KB has no [structured metadata](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data) about any of the pages, which can be important for LLM-indexing. ## Solution Follow up to #51497 and #51496, but for KB. Adds two types of structured data to every KB article: - Breadcrumb - TechArticle (validation available at [schema.org](https://validator.schema.org/#url=https%3A%2F%2Fkb-git-kody-devrel-698-kb-structured-data-supabase.vercel.app%2Fkb%2Fguides%2Fsample-guide)) Future work will likely add in an FAQ type. ## Preview links https://kb-git-kody-devrel-698-kb-structured-data-supabase.vercel.app/kb/guides/sample-guide image https://validator.schema.org/#url=https%3A%2F%2Fkb-git-kody-devrel-698-kb-structured-data-supabase.vercel.app%2Fkb%2Fguides%2Fsample-guide --------- Co-authored-by: Claude Haiku 5.5 --- apps/kb/src/layouts/ArticleLayout.astro | 5 +- apps/kb/src/layouts/Layout.astro | 5 +- apps/kb/src/lib/json-ld.ts | 63 +++++++++++++++++++ apps/kb/src/pages/guides/[...slug].astro | 20 +++++- apps/kb/src/pages/topics/[topic].astro | 8 ++- .../src/pages/troubleshooting/[...slug].astro | 12 +++- 6 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 apps/kb/src/lib/json-ld.ts diff --git a/apps/kb/src/layouts/ArticleLayout.astro b/apps/kb/src/layouts/ArticleLayout.astro index 5e169613c5c..e8cb9479bd7 100644 --- a/apps/kb/src/layouts/ArticleLayout.astro +++ b/apps/kb/src/layouts/ArticleLayout.astro @@ -15,16 +15,17 @@ interface Props { github_url?: string viewGitHubLink?: string date?: string + jsonLd?: Record | Record[] } -const { title, description, topics = [], github_url, viewGitHubLink, date } = Astro.props +const { title, description, topics = [], github_url, viewGitHubLink, date, jsonLd } = Astro.props function isKnownTopic(topic: string): topic is Topic { return (TOPIC_NAMES as readonly string[]).includes(topic) } --- - +

{title}

{date &&

{date}

} diff --git a/apps/kb/src/layouts/Layout.astro b/apps/kb/src/layouts/Layout.astro index 959404eef0b..0140669e673 100644 --- a/apps/kb/src/layouts/Layout.astro +++ b/apps/kb/src/layouts/Layout.astro @@ -3,13 +3,15 @@ import { genFaviconLinks } from 'common/MetaFavicons/icons' import Footer from '../components/Footer.astro' import { Header } from '../components/Header' import '../styles/globals.css' +import { serializeJsonLd } from '../lib/json-ld' interface Props { title: string description?: string + jsonLd?: Record | Record[] } -const { title, description } = Astro.props +const { title, description, jsonLd } = Astro.props const faviconRoute = import.meta.env.DEV ? '/favicon/local' : '/favicon' --- @@ -44,6 +46,7 @@ const faviconRoute = import.meta.env.DEV ? '/favicon/local' : '/favicon' /> {title} | Supabase Knowledge Base + {jsonLd &&