The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(changelog) - add structured data to entries (#51496)
Kody Jackson21934397cae6
diff --git a/apps/www/lib/json-ld.ts b/apps/www/lib/json-ld.tsindex 5cd493e7a4d..53ee36c35f7 100644--- a/apps/www/lib/json-ld.ts+++ b/apps/www/lib/json-ld.ts@@ -185,3 +185,65 @@ export function blogPostingSchema(input: BlogPostingSchemaInput) {},}}++interface TechArticleSchemaInput {+ url: string+ headline: string+ description?: string+ datePublished: string+}++export function techArticleSchema(input: TechArticleSchemaInput) {+ return {+ '@context': 'https://schema.org',+ '@type': 'TechArticle',+ '@id': `${input.url}#page`,+ mainEntityOfPage: {+ '@type': 'WebPage',+ '@id': input.url,+ },+ url: input.url,+ headline: input.headline,+ description: input.description,+ inLanguage: 'en',+ datePublished: input.datePublished,+ publisher: {+ '@type': 'Organization',+ '@id': ORG_ID,+ name: SITE_NAME,+ logo: {+ '@type': 'ImageObject',+ url: ORG_LOGO_URL,+ },+ },+ isPartOf: { '@id': SITE_ID },+ }+}++interface CollectionPageSchemaInput {+ url: string+ name: string+ description?: string+ items: Array<{ url: string; name: string }>+}++export function collectionPageSchema(input: CollectionPageSchemaInput) {+ return {+ '@context': 'https://schema.org',+ '@type': 'CollectionPage',+ '@id': `${input.url}#page`,+ url: input.url,+ name: input.name,+ description: input.description,+ isPartOf: { '@id': SITE_ID },+ mainEntity: {+ '@type': 'ItemList',+ itemListElement: input.items.map((item, index) => ({+ '@type': 'ListItem',+ position: index + 1,+ url: item.url,+ name: item.name,+ })),+ },+ }+}diff --git a/apps/www/pages/changelog.tsx b/apps/www/pages/changelog.tsxindex d1a7d23fbeb..94957cf1c55 100644--- a/apps/www/pages/changelog.tsx+++ b/apps/www/pages/changelog.tsx@@ -37,14 +37,20 @@ import {itemMatchesChangelogSelectedStages,itemMatchesChangelogSelectedTags,itemMatchesChangelogSelectedTypes,+ stripTitleMarkdown,toChangelogTimelineIndexItem,type ChangelogTimelineIndexItem,} from '@/lib/changelog.utils'+import { breadcrumbListSchema, collectionPageSchema, serializeJsonLd } from '@/lib/json-ld'import mdxComponents from '@/lib/mdx/mdxComponents'import { mdxSerialize } from '@/lib/mdx/mdxSerialize'const FEATURED_COUNT = 3+const TITLE = 'Changelog'+const DESCRIPTION = 'New updates and improvements to Supabase'+const CHANGELOG_URL = 'https://supabase.com/changelog'+type FeaturedEntry = {slug: stringtitle: string@@ -96,10 +102,33 @@ export const getServerSideProps: GetServerSideProps<PageProps> = async ({ res })}export default function ChangelogPage(props: PageProps) {+ const collectionJsonLd = collectionPageSchema({+ url: CHANGELOG_URL,+ name: TITLE,+ description: DESCRIPTION,+ items: props.allIndex.map((item) => ({+ url: `https://supabase.com/changelog/${item.slug}`,+ name: stripTitleMarkdown(item.title),+ })),+ })+ const breadcrumbJsonLd = breadcrumbListSchema([+ { name: 'Home', url: 'https://supabase.com' },+ { name: TITLE, url: CHANGELOG_URL },+ ])return (- <NuqsAdapter>- <ChangelogIndex {...props} />- </NuqsAdapter>+ <>+ <script+ type="application/ld+json"+ dangerouslySetInnerHTML={{ __html: serializeJsonLd(collectionJsonLd) }}+ />+ <script+ type="application/ld+json"+ dangerouslySetInnerHTML={{ __html: serializeJsonLd(breadcrumbJsonLd) }}+ />+ <NuqsAdapter>+ <ChangelogIndex {...props} />+ </NuqsAdapter>+ </>)}@@ -232,9 +261,6 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {const singleSelectedTag = selectedTags.size === 1 ? [...selectedTags][0] : null- const TITLE = 'Changelog'- const DESCRIPTION = 'New updates and improvements to Supabase'-return (<><Head>diff --git a/apps/www/pages/changelog/[slug].tsx b/apps/www/pages/changelog/[slug].tsxindex 692a8ab1ade..43080ccdba9 100644--- a/apps/www/pages/changelog/[slug].tsx+++ b/apps/www/pages/changelog/[slug].tsx@@ -12,11 +12,13 @@ import CTABanner from '@/components/CTABanner'import DefaultLayout from '@/components/Layouts/Default'import { getChangelogEntries, type ChangelogEntryFrontmatter } from '@/lib/changelog-repo'import { stripTitleMarkdown } from '@/lib/changelog.utils'+import { breadcrumbListSchema, serializeJsonLd, techArticleSchema } from '@/lib/json-ld'import mdxComponents from '@/lib/mdx/mdxComponents'import { mdxSerialize } from '@/lib/mdx/mdxSerialize'type PageProps = {title: string+ summary: stringcreated_at: stringslug: stringfrontmatter: ChangelogEntryFrontmatter@@ -26,6 +28,7 @@ type PageProps = {const ChangelogDetailPage = ({title,+ summary,created_at,slug,frontmatter,@@ -33,8 +36,27 @@ const ChangelogDetailPage = ({hasMarkdownVariant,}: PageProps) => {const plainTitle = stripTitleMarkdown(title)+ const url = `https://supabase.com/changelog/${slug}`+ const techArticleJsonLd = techArticleSchema({+ url,+ headline: plainTitle,+ description: summary,+ datePublished: created_at,+ })+ const breadcrumbJsonLd = breadcrumbListSchema([+ { name: 'Changelog', url: 'https://supabase.com/changelog' },+ { name: plainTitle, url },+ ])return (<>+ <script+ type="application/ld+json"+ dangerouslySetInnerHTML={{ __html: serializeJsonLd(techArticleJsonLd) }}+ />+ <script+ type="application/ld+json"+ dangerouslySetInnerHTML={{ __html: serializeJsonLd(breadcrumbJsonLd) }}+ />{hasMarkdownVariant && (<Head><link rel="alternate" type="text/markdown" href={`/changelog/${slug}.md`} />@@ -113,6 +135,7 @@ export const getStaticProps: GetStaticProps<PageProps> = async ({ params }) => {return {props: {title: entry.frontmatter.title,+ summary: stripTitleMarkdown(entry.summary).replace(/\s+/g, ' '),created_at: entry.sortDate,slug: entry.slug,frontmatter: entry.frontmatter,