The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(www): gate changelog md alternate on slug set (#49754)
Pamela Chia8aade7796694
diff --git a/apps/www/md-alternates.test.ts b/apps/www/md-alternates.test.tsindex d610d636063..27791115c60 100644--- a/apps/www/md-alternates.test.ts+++ b/apps/www/md-alternates.test.ts@@ -91,6 +91,25 @@ describe('markdown alternate drift', () => {).toBe(true)})+ it('changelog entry page gates its .md alternate on CHANGELOG_PAGES membership', async () => {+ const source = await fs.readFile(+ path.join(process.cwd(), 'pages', 'changelog', '[slug].tsx'),+ 'utf-8'+ )+ expect(+ source.includes('CHANGELOG_PAGES.has(`changelog/${entry.slug}`)'),+ 'pages/changelog/[slug].tsx must compute the markdown alternate flag from CHANGELOG_PAGES membership using the changelog/-prefixed key the generator emits'+ ).toBe(true)+ expect(+ source.includes('hasMarkdownVariant &&'),+ 'pages/changelog/[slug].tsx must render the markdown alternate link only when hasMarkdownVariant is true'+ ).toBe(true)+ expect(+ source.includes('rel="alternate" type="text/markdown"'),+ 'pages/changelog/[slug].tsx must advertise the text/markdown alternate for published slugs'+ ).toBe(true)+ })+it.for(MDX_SECTIONS)('%s pages advertise their .md sibling', async (urlPrefix) => {const appPagePath = path.join(process.cwd(), 'app', urlPrefix, '[slug]', 'page.tsx')if (!existsSync(appPagePath)) {diff --git a/apps/www/pages/changelog/[slug].tsx b/apps/www/pages/changelog/[slug].tsxindex c27fd4281f2..692a8ab1ade 100644--- a/apps/www/pages/changelog/[slug].tsx+++ b/apps/www/pages/changelog/[slug].tsx@@ -5,6 +5,7 @@ import { NextSeo } from 'next-seo'import Head from 'next/head'import Link from 'next/link'+import { CHANGELOG_PAGES } from '@/app/api-v2/md/content.generated'import { ChangelogDetailSidebar } from '@/components/Changelog/ChangelogDetailSidebar'import { ChangelogInlineMarkdown } from '@/components/Changelog/ChangelogInlineMarkdown'import CTABanner from '@/components/CTABanner'@@ -20,15 +21,25 @@ type PageProps = {slug: stringfrontmatter: ChangelogEntryFrontmattersource: MDXRemoteSerializeResult+ hasMarkdownVariant: boolean}-const ChangelogDetailPage = ({ title, created_at, slug, frontmatter, source }: PageProps) => {+const ChangelogDetailPage = ({+ title,+ created_at,+ slug,+ frontmatter,+ source,+ hasMarkdownVariant,+}: PageProps) => {const plainTitle = stripTitleMarkdown(title)return (<>- <Head>- <link rel="alternate" type="text/markdown" href={`/changelog/${slug}.md`} />- </Head>+ {hasMarkdownVariant && (+ <Head>+ <link rel="alternate" type="text/markdown" href={`/changelog/${slug}.md`} />+ </Head>+ )}<NextSeotitle={`${plainTitle} · Changelog`}description={plainTitle}@@ -106,6 +117,7 @@ export const getStaticProps: GetStaticProps<PageProps> = async ({ params }) => {slug: entry.slug,frontmatter: entry.frontmatter,source,+ hasMarkdownVariant: CHANGELOG_PAGES.has(`changelog/${entry.slug}`),},revalidate: 900,}