Files
supabase/apps/docs/style-guide/templates/reference.md
Miranda Limonczenko 6c1a220c28 docs: add the reference template to the style guide (#54454)
Closes DOCS-1612

## Problem

Lookup pages, such as a table of limits or a list of error codes, have
no template, so they vary widely. Some put 81 codes in tables with no
anchors, and others list every code in the table of contents.

## Solution

- Add `templates/reference.md`. It covers the intro, choosing a table or
headings, grouping many entries, notes, and a required Related resources
section, with one full example cut down from Realtime limits.
- Require a lead-in sentence before every list and table in
`02-elements.md`.
- Add the reference row to the template router, a title rule for
reference pages, and a Reference entry in the write-the-docs
content-type gate.

## Preview links

The style guide isn't served on the docs site, so these link to the
rendered files on the branch.

| File | Preview |
| --- | --- |
| Reference template |
[`templates/reference.md`](https://github.com/supabase/supabase/blob/docs/reference-template/apps/docs/style-guide/templates/reference.md)
|
| Lead-in rule |
[`02-elements.md`](https://github.com/supabase/supabase/blob/docs/reference-template/apps/docs/style-guide/02-elements.md#introduce-every-list-with-a-lead-in-sentence)
|
| Template router |
[`03-page-structure.md`](https://github.com/supabase/supabase/blob/docs/reference-template/apps/docs/style-guide/03-page-structure.md#choose-a-template)
|

## Review category (docs PRs only)

<!--
If this PR changes docs and you're on the Supabase team, select one
category.
PRs from forks are always reviewed as Low, so you can skip this section.
-->

- [ ] Critical: needs a review as soon as possible
- [ ] Urgent: the feature ships soon, or it's blocking something else
- [x] Moderate: good to have soon, not urgent
- [ ] Low: get to it when you can

## Review instructions

1. Open the reference template preview and read it top to bottom.
2. Compare its example with the [Realtime limits page in
#54484](https://docs-git-docs-reference-rework-supabase.vercel.app/docs/guides/realtime/limits),
which follows the template.

## Checklist

Check all before review:

- [ ] 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)
2026-12-04 14:45:07 -08:00

178 lines
7.4 KiB
Markdown

# Reference template
**Category:** Concept content.
**Reader question:** "What is the value or limit?"
A reference page is for looking something up, like a limit, an error code, or a setting.
Readers don't read it from top to bottom. They arrive looking for one thing, find it, and
leave. Keep explanations, use cases, and steps on other pages, and link to them.
When a page grows past 10 entries with their own headings, split it into one page
per category, and link the pages to each other. A table can have as many rows as it
needs. When you split an existing page, find the links to each entry that moves, in the
docs, `apps/www`, and Studio, and update them to the new page.
## Frontmatter
Set the following fields:
- `title`: a noun phrase of 35 characters or fewer that names what the page lists. Name
the product when the title could belong to more than one, per
[Title](../03-page-structure.md#title).
- `description`: one sentence of 150 to 160 characters that names what the reader can
look up.
## Headings, in order
The following outline lists the page's headings and how to name them:
1. **Required**: An H2 for each set of entries, named for what the set holds, such as
`## Limits by plan`.
2. **Optional**: An H3 for each category, when a set has more than six headed entries. See
[Group many entries](#group-many-entries).
3. **Optional**: A heading for each entry, when the entries need one. Write it as the
identifier the reader sees, such as the error code in a response.
4. **Required**: `## Related resources`, last on the page.
Put at least one sentence under every heading, even a short one, before any subheading,
list, or table.
## Write the intro
Open the page, before the first heading, with one or two sentences that say what the
page lists and when to use it. Start with what the reader does, such as `Look up the
limits on …`, rather than with `This page` or `Use this page`. A reader who lands here
from search or from a link should know right away that they're in the right place.
When readers come to the page because something happened, such as an error code or a
status code in a response, list those circumstances under a lead-in sentence. Take each
one from a real source, such as the product's error code list, a message the SDK returns,
or a Dashboard screen that links to the page. Don't guess.
When readers can change the values, end the intro with a link to the page that shows
how.
## Choose a table or headings
Docs search returns each heading as its own result, and other pages can link to a
heading. A table row can't do either. Use the following table to choose a format for
each set of entries:
| When the entries | Use |
| ------------------------------------------------------- | ------------------- |
| Are short values that readers compare across rows | A table |
| Need more than a short value, such as a cause and a fix | A heading per entry |
| Are names that readers search for or link to | A heading per entry |
A page can use both, such as a table of limits followed by a heading for each error that
a limit causes.
Give a table a header row, one row per entry, short cells, and a lead-in sentence. When a
value lives in `packages/shared-data`, render it with `<SharedData>` instead of typing it,
so the page stays current.
## Group many entries
The table of contents on the right lists only H2 and H3 headings, so a table can have
any number of rows. When a set has more than six entries with their own headings, keep
the entries out of the table of contents in the following way:
- Group the entries into categories. Each category is an H3, and each entry
is an H4.
- Name each category for something the reader already knows when they arrive, such as
the status code they got.
- Within a category, order the entries the way readers look for them, usually
alphabetically or by code.
Give every entry the same labeled parts in the same order. Changing a heading's level
keeps its link working, but renaming it breaks links from other pages.
## Add notes
When a fact applies to more than one entry, add it as a note after the entries. Put the
notes in a list with a lead-in sentence. A note that runs past two sentences is an
explanation, so move it to an explainer and link to it.
## Add related resources
End every reference page with `## Related resources`. List the how-to guides that change
these values first, then explainers. Introduce the list with a lead-in sentence, and give
each link a reason.
## Example
The following example is cut down from [Realtime limits](/docs/guides/realtime/limits).
The limits are short values that readers compare by plan, so they go in a table. The
errors are names that readers search for, so each one gets a heading:
```mdx
---
title: 'Realtime limits'
description: 'Look up Realtime limits by plan, such as concurrent connections, messages per second, and payload sizes, and the errors Realtime returns when you exceed one.'
---
Look up Realtime limits by plan and the errors Realtime returns when you exceed one. Check this page when you see any of the following:
- A Channel join refused with `too_many_channels` or `too_many_connections`
- The **Realtime Messages** section of your organization's [**Usage**](/dashboard/org/_/usage) page
To increase a limit, upgrade your plan or [contact support](/dashboard/support/new).
## Limits by plan
The following table lists the limits for each plan.
| Limit | Free | Pro | Team |
| ----------------------- | ---- | --- | ------ |
| Concurrent connections | 200 | 500 | 10,000 |
| Channels per connection | 100 | 100 | 100 |
All limits are configurable per project.
## Limit errors
Realtime refuses a Channel join with one of the following WebSocket messages when you reach a limit.
### `too_many_channels`
Too many channels currently joined for a single connection.
### `too_many_connections`
Too many total concurrent connections for a project.
## Related resources
To set or troubleshoot these limits, see the following pages:
- [Realtime settings](/docs/guides/realtime/settings): set a project's limits, up to the ceilings your plan allows.
- [Operational error codes](/docs/guides/realtime/error_codes): every operational error code Realtime returns.
```
## Not recommended and Recommended
The following pairs show common mistakes and what to do instead:
- **Not recommended**: A table of 80 error codes. **Recommended**: A heading for each
code, split across pages by category, with up to 10 codes on each page.
- **Not recommended**: A `curl` command that changes a limit. **Recommended**: A link to
the how-to guide that changes it.
- **Not recommended**: A default value typed by hand. **Recommended**: The value rendered
with `<SharedData>`.
## Checklist
Before you open a pull request, check the following:
- [ ] The page covers one lookup subject, with no explanations, use cases, or steps.
- [ ] The intro says what the page lists and when to use it, and lists any circumstances
that bring readers here.
- [ ] Each set of entries is a table or a heading per entry, as the format table picks.
- [ ] Every heading has at least one sentence under it.
- [ ] Every table and every list has a lead-in sentence.
- [ ] A set with more than six headed entries is grouped into H3 categories, with an H4
per entry.
- [ ] A page with more than 10 headed entries is split by category.
- [ ] The page ends with `## Related resources`, and each link has a reason.