Files
supabase/apps/docs/data/content-listings/the-supabase-way-to-build.data.ts
Miranda Limonczenko 1d50816f47 docs: enforce duplicate ID a11y rules and fix duplicates (#52720)
Closes DOCS-1573

## Problem

Recently, @antlio surfaced that our side nav was visually breaking. This
is caused by a duplicate-id issue.

The docs E2E axe scan reports duplicate `id` attributes as a warning
only, so pages with duplicate IDs ship. A full scan of production guides
found duplicate IDs on 25 of 586 pages.

**Causes:**

- **Repeated headings:** a page uses the same heading text twice, for
example `#### Example` under two sections. Each heading slugs to the
same ID.
- **Pricing partials:** three usage pages put `## Pricing` directly
above a shared partial that starts with its own Pricing heading.
- **Components:** Mermaid diagrams hardcode SVG marker and node IDs. The
Apple secret generator renders `id="undefined-optional"` on each field
label. Each "Build it" listing on the Supabase way page renders
`#build-it`.

## Solution

- **Enforce the rules:** add `duplicate-id`, `duplicate-id-active`, and
`duplicate-id-aria` to `ENFORCED_RULES`.
- **Repeated headings:** give each later duplicate a
`[#parent-section-heading]` anchor. The first occurrence keeps its ID.
- **Pricing headings:** remove the page heading above the three partials
that start with `## Pricing`. The PITR partial starts with `###
Pricing`, so it gets `[#pitr-pricing]` and the page keeps its H2.
- **Mermaid:** prefix the SVG IDs of each diagram with `useId()`.
- **Apple secret generator:** give each field an ID. The label now also
points at its input.
- **Content listings:** add an optional `headingAnchor` to listing
groups, and set it on the repeated "Build it" groups.
- **pg_net:** the `http_delete` signature had `[#post-signature]`,
copied from `http_post`. It is now `[#delete-signature]`.

**Cross-references:** no link in the repo targets a changed ID. Each
first occurrence keeps its ID, so existing links resolve to the same
heading as before.

**Not changed:** the www suite and `packages/ui-patterns`. All fixes
stay in `apps/docs`.

**Verification:**

- Against production,
`/docs/guides/platform/manage-your-usage/log-drains` fails the @a11y
test with `duplicate-id`.
- Against a local docs server, the @a11y test passes on all 28 changed
or affected pages.

**Unverified:** a full-site run with `A11Y_ENFORCE_ALL=1`. Run it
against the preview before merge.

## Review instructions

1. From `e2e/docs`, run the a11y test against production. See it fail
with `duplicate-id`:

   ```bash
DOCS_E2E_PAGE_PATHS=/docs/guides/platform/manage-your-usage/log-drains
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm exec playwright test
--grep @a11y
   ```

2. Run the same command with `PLAYWRIGHT_BASE_URL` set to the docs
preview URL from the Vercel bot comment. See it pass.
3. On the preview, open
`/docs/guides/platform/manage-your-usage/log-drains`. In the table of
contents, select **Pricing** under **Log Drain Events**. See the page
scroll to the second Pricing section.
4. On the preview, open
`/docs/guides/integrations/partner-integration-guide`. See both sequence
diagrams render with arrowheads.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] 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)
2026-11-03 11:56:33 -08:00

224 lines
6.1 KiB
TypeScript

import type { ContentListingGroup } from '~/lib/content-listings.schema'
export const supabaseWayProgression: ContentListingGroup = {
id: 'supabase-way-progression',
type: 'progression',
labelledBy: 'the-progression-at-a-glance',
items: [
{
title: 'Start with a database',
subtitle: 'Postgres + API',
href: '#start-with-a-database-postgres--api',
icon: 'database',
},
{
title: 'Add users',
subtitle: 'Auth',
href: '#add-users-auth',
icon: 'auth',
},
{
title: 'Scope data to each user',
subtitle: 'Row Level Security',
href: '#scope-data-to-each-user-row-level-security',
icon: 'rls',
},
{
title: 'Handle files and uploads',
subtitle: 'Storage',
href: '#handle-files-and-uploads-storage',
icon: 'storage',
},
{
title: 'Add server-side logic',
subtitle: 'Edge Functions',
href: '#add-server-side-logic-edge-functions',
icon: 'functions',
},
{
title: 'Reflect changes live',
subtitle: 'Realtime',
href: '#reflect-changes-live-realtime',
icon: 'realtime',
},
{
title: 'Serve real traffic',
subtitle: 'Harden for production',
href: '#serve-real-traffic-harden-for-production',
icon: 'production',
},
],
}
export const supabaseWayDatabaseBuild: ContentListingGroup = {
id: 'supabase-way-database-build',
heading: 'Build it',
headingLevel: 'h3',
type: 'grid',
columns: 3,
items: [
{
title: 'Tables and data',
href: '/guides/database/tables',
description: 'Create tables and relationships, and edit rows from the Dashboard.',
},
{
title: 'API keys',
href: '/guides/getting-started/api-keys',
description: 'Use a publishable key in the browser and a secret key only on the server.',
},
{
title: 'Connect a framework',
href: '/guides/getting-started/quickstarts/nextjs',
description: 'Wire your app to Supabase with a framework quickstart.',
},
],
}
export const supabaseWayAuthBuild: ContentListingGroup = {
id: 'supabase-way-auth-build',
heading: 'Build it',
headingAnchor: 'build-it-auth',
headingLevel: 'h3',
type: 'grid',
columns: 3,
items: [
{
title: 'Password-based auth',
href: '/guides/auth/passwords',
description: 'Sign up and sign in users with email and password.',
},
{
title: 'Server-side auth',
href: '/guides/auth/server-side',
description: 'Handle sessions and cookies in server-rendered apps.',
},
{
title: 'Which package to use',
href: '/guides/auth/choosing-a-server-package',
description: 'Choose supabase-js, @supabase/ssr, or @supabase/server for server code.',
},
],
}
export const supabaseWayRlsBuild: ContentListingGroup = {
id: 'supabase-way-rls-build',
heading: 'Build it',
headingAnchor: 'build-it-rls',
headingLevel: 'h3',
type: 'grid',
columns: 2,
items: [
{
title: 'Row Level Security',
href: '/guides/database/postgres/row-level-security',
description: 'Write policies that Postgres enforces on every query.',
},
{
title: 'Column Level Security',
href: '/guides/database/postgres/column-level-security',
description: 'Restrict access to specific columns within a table.',
},
],
}
export const supabaseWayRealtimeBuild: ContentListingGroup = {
id: 'supabase-way-realtime-build',
heading: 'Build it',
headingAnchor: 'build-it-realtime',
headingLevel: 'h3',
type: 'grid',
columns: 3,
items: [
{
title: 'Broadcast from database',
href: '/guides/realtime/subscribing-to-database-changes#using-broadcast',
description:
'Send database changes to subscribed clients with Broadcast, the scalable option.',
},
{
title: 'Postgres Changes',
href: '/guides/realtime/postgres-changes',
description: 'Subscribe to table changes directly. Simpler to set up, with scaling limits.',
},
{
title: 'Presence',
href: '/guides/realtime/presence',
description: 'Track who is online and share ephemeral state.',
},
],
}
export const supabaseWayStorageBuild: ContentListingGroup = {
id: 'supabase-way-storage-build',
heading: 'Build it',
headingAnchor: 'build-it-storage',
headingLevel: 'h3',
type: 'grid',
columns: 2,
items: [
{
title: 'Storage quickstart',
href: '/guides/storage/quickstart',
description: 'Upload files to a bucket and serve them.',
},
{
title: 'Access control',
href: '/guides/storage/security/access-control',
description: 'Secure buckets and objects with RLS policies.',
},
],
}
export const supabaseWayFunctionsBuild: ContentListingGroup = {
id: 'supabase-way-functions-build',
heading: 'Build it',
headingAnchor: 'build-it-functions',
headingLevel: 'h3',
type: 'grid',
columns: 3,
items: [
{
title: 'Edge Functions overview',
href: '/guides/functions',
description: 'Run TypeScript server-side, close to your users.',
},
{
title: 'Database functions',
href: '/guides/database/functions',
description: 'Keep data-shaped logic inside Postgres.',
},
{
title: 'Database webhooks',
href: '/guides/database/webhooks',
description: 'Trigger external services when your data changes.',
},
],
}
export const supabaseWayProductionBuild: ContentListingGroup = {
id: 'supabase-way-production-build',
heading: 'Build it',
headingAnchor: 'build-it-production',
headingLevel: 'h3',
type: 'grid',
columns: 3,
items: [
{
title: 'Production checklist',
href: '/guides/deployment/going-into-prod',
description: 'What to review before you launch.',
},
{
title: 'Connection pooling',
href: '/guides/database/connecting-to-postgres',
description: 'Choose a direct connection or a Supavisor pooler for your clients.',
},
{
title: 'Backups',
href: '/guides/platform/backups',
description: 'Scheduled backups on paid plans, and how to restore them.',
},
],
}