Files
supabase/apps/design-system/app/(app)/docs/[[...slug]]/page.tsx
2b85c37aea fix: broken links from the Web 404 Review, week of 2026-10-26 (#52617)
<!-- claude-slack-attribution -->
_Requested via [Slack
thread](https://supabase.slack.com/archives/C076KTY11DF/p1793584471038389?thread_ts=1793584471.038389&cid=C076KTY11DF)_

## Problem

The weekly Web 404 Review found broken URLs that are emitted by links in
this repo, or that a redirect can send to a live page. I fixed the ones
I confirmed in the code. Each fix is its own commit, so any one of them
can be dropped by reverting that commit.

## Solution

| Path that 404s | App | Change |
| --- | --- | --- |
| `/blog/sitemap.xml` | www | Add a permanent redirect to
`/sitemap_www.xml` in `apps/www/lib/redirects.js`, next to the existing
`/blog/rss.xml` redirect. Old supabase.io links still point at this
legacy per-section sitemap. |
| `/partners/sitemap.xml` | www | Add a permanent redirect to
`/sitemap_www.xml` in `apps/www/lib/redirects.js`, next to the other
`/partners/*` redirects. Same legacy supabase.io source. |
| `/design-system/og.jpg` | design-system |
`apps/design-system/config/site.ts`: `ogImage` pointed at a file that
was never added to the app. Point it at
`https://supabase.com/docs/img/supabase-og-image.png`, the shared OG
image that docs, learn, and kb already use. That image is 1200x600, so
`og:image:height` in
`apps/design-system/app/(app)/docs/[[...slug]]/page.tsx` changes from
630 to 600 to match. |
| `/docs/reference/auth/config` | docs |
`apps/docs/spec/supabase_kt_v1.yml`, `supabase_kt_v2.yml`,
`supabase_kt_v3.yml`, `supabase_swift_v1.yml`, `supabase_swift_v2.yml`:
the refresh token rotation and `REFRESH_TOKEN_REUSE_INTERVAL` links now
go to
`/docs/guides/local-development/cli/config#auth.enable_refresh_token_rotation`
and `#auth.refresh_token_reuse_interval`, matching the Dart v2 spec.
Also add a permanent redirect from `/docs/reference/auth/config` to
`/docs/guides/local-development/cli/config` in
`apps/docs/lib/redirects/static-redirects.json`, so external links to
the old URL stop 404ing. |
| `/app/settings/api-keys` | docs |
`elevenlabs-generate-speech-stream.mdx` and
`elevenlabs-transcribe-speech.mdx`: the ElevenLabs API key link was a
relative path that resolved on supabase.com. It now uses
`https://elevenlabs.io/app/developers/api-keys`, the current ElevenLabs
path (`/app/settings/api-keys` 308s there). The code-sample comments on
both pages use the same URL. |

I left out the other lines in the review. They need feature work, live
outside this repo, or come from stale clients with no matching link in
the code.

## To test

- [x] www preview: open `/blog/sitemap.xml`. It should 308 redirect to
`/sitemap_www.xml` and render the sitemap.
- [x] www preview: open `/partners/sitemap.xml`. It should 308 redirect
to `/sitemap_www.xml` and render the sitemap.
- [x] design-system preview: view source on any
`/design-system/docs/...` page. The `og:image` and `twitter:image` meta
tags should be `https://supabase.com/docs/img/supabase-og-image.png`,
and that URL should load an image. `og:image:height` should be `600`.
- [x] docs preview: open `/docs/reference/kotlin/auth-setsession` and
`/docs/reference/swift/auth-setsession`. The "Refresh token rotation"
and `REFRESH_TOKEN_REUSE_INTERVAL` links should open the matching
sections of `/docs/guides/local-development/cli/config`.
- [x] docs preview: open `/docs/reference/auth/config`. It should 308
redirect to `/docs/guides/local-development/cli/config`.
- [x] docs preview: open `/docs/reference/auth`. It should still 308
redirect to `/docs/reference/self-hosting-auth/start`, so the new
`/docs/reference/auth/config` entry doesn't collide with it.
- [x] docs preview: open
`/docs/guides/functions/examples/elevenlabs-generate-speech-stream` and
`/docs/guides/functions/examples/elevenlabs-transcribe-speech`. The "API
key" link under Requirements should go to
`https://elevenlabs.io/app/developers/api-keys`.

## Checklist

- [ ] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

## Linear

- fixes GROWTH-1409

---
_Generated by [Claude
Code](https://claude.ai/code/session_011aGhSAkL6hxEkWQxXbNazM)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>
2026-11-02 18:29:52 +08:00

149 lines
4.5 KiB
TypeScript

import { Mdx } from '@/components/mdx-components'
import { DocsPager, getBreadcrumbSegments } from '@/components/pager'
import { SourcePanel } from '@/components/source-panel'
import { DashboardTableOfContents } from '@/components/toc'
import { siteConfig } from '@/config/site'
import { getAllDocs, getDocBySlug, getDocMetaBySlug } from '@/lib/docs'
import { getTableOfContents } from '@/lib/toc'
import { absoluteUrl } from '@/lib/utils'
/* eslint-disable turbo/no-undeclared-env-vars */
import '@/styles/mdx.css'
import { ChevronRight } from 'lucide-react'
import type { Metadata } from 'next'
import Link from 'next/link'
import { notFound } from 'next/navigation'
import Balancer from 'react-wrap-balancer'
import { ScrollArea, Separator } from 'ui'
interface DocPageProps {
params: Promise<{
slug: string[]
}>
}
async function getDocFromParams({ params }: { params: { slug: string[] } }) {
const slug = params.slug?.join('/') || ''
return getDocMetaBySlug(slug)
}
export async function generateMetadata(props: DocPageProps): Promise<Metadata> {
const params = await props.params
const doc = await getDocFromParams({ params })
if (!doc) {
return {}
}
return {
title: doc.title,
description: doc.description,
openGraph: {
title: doc.title,
description: doc.description,
type: 'article',
url: absoluteUrl(doc.slug),
images: [
{
url: siteConfig.ogImage,
width: 1200,
height: 600,
alt: siteConfig.name,
},
],
},
twitter: {
card: 'summary_large_image',
title: doc.title,
description: doc.description,
images: [siteConfig.ogImage],
creator: '@shadcn',
},
}
}
export async function generateStaticParams(): Promise<{ slug: string[] }[]> {
if (process.env.NODE_ENV === 'development') {
return []
}
const allDocs = await getAllDocs()
return allDocs.map((doc) => ({
slug: doc.slugAsParams ? doc.slugAsParams.split('/') : [],
}))
}
export default async function DocPage(props: DocPageProps) {
const params = await props.params
const slug = params.slug?.join('/') || ''
const doc = await getDocBySlug(slug)
if (!doc) {
notFound()
}
const toc = await getTableOfContents(doc.raw)
const breadcrumbSegments = getBreadcrumbSegments(doc)
return (
<div className="relative xl:grid xl:grid-cols-[1fr_160px] gap-4 px-6 py-6 lg:py-8">
<div className="mx-auto w-full min-w-0 max-w-4xl flex-1">
<nav
className="mb-4 flex items-center space-x-1 text-sm text-foreground-lighter"
aria-label="Breadcrumb"
>
{breadcrumbSegments.map((segment, index) => (
<span key={segment.title} className="flex items-center gap-1">
{index > 0 && <ChevronRight className="h-4 w-4 shrink-0 text-foreground-muted" />}
{segment.href ? (
<Link
href={segment.href}
className="overflow-hidden text-ellipsis whitespace-nowrap hover:text-foreground transition-colors"
>
{segment.title}
</Link>
) : (
<span className="overflow-hidden text-ellipsis whitespace-nowrap text-foreground-lighter">
{segment.title}
</span>
)}
</span>
))}
{breadcrumbSegments.length > 0 && (
<ChevronRight className="h-4 w-4 shrink-0 text-foreground-muted/50" />
)}
<span className="overflow-hidden text-ellipsis whitespace-nowrap text-foreground-muted">
{doc.title}
</span>
</nav>
<div className="space-y-2 mb-5">
<h1 className="scroll-m-20 text-4xl tracking-tight">{doc.title}</h1>
{doc.description && (
<p className="text-lg text-foreground-light">
<Balancer>{doc.description}</Balancer>
</p>
)}
</div>
<Separator className="mb-6" />
<SourcePanel doc={doc} />
<div className="pb-12">
<Mdx code={doc.code} />
</div>
<DocsPager doc={doc} />
</div>
{doc.toc && (
<div className="hidden text-sm xl:block">
<div className="sticky top-8 -mt-10 pt-8">
<ScrollArea className="pb-10">
<div className="h-[calc(100vh-3.5rem)] py-14">
<DashboardTableOfContents toc={toc} />
</div>
</ScrollArea>
</div>
</div>
)}
</div>
)
}