How to extend the docs
Add a page, wire it into the sidebar, and keep the site's IA and i18n conventions intact.
You want to add or change a documentation page. The site is a Fumadocs app
under docs/, organized as two audiences (User, Contributor) × four
Diátaxis quadrants, mirrored across en and zh.
Decide the page's home first
Two questions, in order:
- Audience — is this about using the CLI on skills (User) or about the repository itself (Contributor)?
- Type — a guided lesson (Tutorial), a recipe for a concrete goal (How-to), a description of facts (Reference), or a "why" discussion (Explanation)?
Never mix types in one page; split instead. See About the docs information architecture for the reasoning.
Create the page
Add docs/content/docs/en/<section>/<quadrant>/<slug>.mdx:
---
title: The page title
description: One sentence the sidebar and search will show.
---
## ...- Tutorials: steps with expected output, no theory dumps.
- How-to guides: title "How to do X", steps only, link out for facts.
- Reference: facts only, verified against the implementation.
- Explanation: no command lines; trade-offs are allowed here only.
Wire it into the sidebar
Add the slug to the quadrant's meta.json pages array. Use separators
(---Label---) for grouping and keep landing pages as overviews. Example:
{
"title": "How-to Guides",
"icon": "ListChecks",
"pages": ["index", "---Code---", "add-a-lint-rule", "..."]
}Folders that are Diátaxis quadrants or section roots keep their existing
meta.json; do not promote a quadrant to a root folder.
Link, don't duplicate
Use relative file links (.mdx paths) — they resolve to the reader's
current locale automatically:
See [the CLI overview](../../user/reference/cli.mdx).Absolute URLs (/en/docs/...) are only for links that must stay in one
locale.
Mirror the page in zh
Copy the file to docs/content/docs/zh/ at the identical path. English
text is the acceptable placeholder state; a later pass translates it. See
How to translate the docs. Structural parity
between en/ and zh/ is a build-quality invariant — same paths, same
meta.json structure.
Verify
pnpm --dir docs types:check
pnpm --dir docs build
pnpm --dir docs start # spot-check the page and its linksThe build fails on broken page-tree references; dead links inside content
need a manual pass (or the docs:vhs-style checks later phases will add).
Related
- What each file in
docs/libdoes: Docs stack reference - Why
en/zhmirrors: i18n layout reference