Split docs into Documentation and API Reference tabs - #57
Merged
Conversation
The docs site had a single flat nav: seven sections in one sidebar, with
the generated Cloud API reference sitting inside it as just another
folder. This promotes the reference to its own layout tab.
Fumadocs derives tabs from page-tree folders marked `"root": true` — the
tree root itself never qualifies, which is why the existing `"root": true`
in content/docs/meta.json produced no tabs at all. So each tab now needs a
folder of its own:
- content/docs/(guide)/ — Documentation
- content/docs/reference/ — API Reference
The parentheses make `(guide)` a folder group, which fumadocs strips from
the URL, so every guide page keeps its path: (guide)/overview/quickstart.md
still publishes at /docs/overview/quickstart. No redirects needed for the
six guide sections.
CLI and MCP move out of the reference tab into a new Usage section under
Documentation — they document how you drive BitRouter, not the Cloud REST
surface. Those URLs do change (/docs/reference/cli/* → /docs/usage/cli/*),
so they get wildcard redirects, placed above the broader /docs/reference
rules that would otherwise swallow them.
Tab rendering itself needs no new code. The desktop strip in DocsHeader is
already a port of fumadocs' LayoutHeaderTabs, and the sidebar renders the
native tabs dropdown below lg. Both light up once the root folders exist.
Two generator fixes matter most here, because both would have reverted the
refactor at build time rather than failing loudly:
- generate-openapi.mjs rewrites reference/meta.json on every prebuild. It
was emitting `{title: "Reference", defaultOpen: false}` and re-listing
cli/mcp — dropping `root: true` deletes the tab. The section meta now
comes from a REFERENCE_META constant with a comment saying why.
- generate-cli.mjs still wrote to content/docs/reference/cli/, which would
have resurrected the old pages as duplicates.
Also fixes two places that rebuilt file paths from slugs — the GitHub edit
link and the sitemap's git lastmod. Neither survives a folder group, and
both were already wrong for `.md` pages since they hardcoded `.mdx`; they
now use `page.path`.
Header: the row overflowed at 375px, pushing the CTA over the search
trigger, so the wordmark drops below `sm`. More importantly, DocsHeader
replaces fumadocs' header wholesale and never rendered
`slots.sidebar.trigger` — below `md` the sidebar is a drawer, and that
drawer is the only place the tabs dropdown lives, so the docs nav and the
API Reference tab were unreachable on a phone. It now passes the native
trigger through a new leadingSlot on WebHeaderBody.
Verified: lint:docs passes, 83 tests pass, a full build prerenders 119 doc
pages, re-running both generators reproduces reference/meta.json unchanged
with `root: true` intact, and the redirects return 308.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promotes the generated Cloud API reference out of the docs sidebar into its own top-level tab, so the docs nav reads Documentation | API Reference instead of seven sections in one flat list.
How the tabs work
Fumadocs derives layout tabs from page-tree folders marked
"root": true. The tree root itself never qualifies — which is why the existing"root": trueincontent/docs/meta.jsonproduced no tabs at all. Each tab therefore needs its own folder:content/docs/(guide)/— Documentationcontent/docs/reference/— API ReferenceThe parentheses make
(guide)a folder group, which fumadocs strips from the URL.(guide)/overview/quickstart.mdstill publishes at/docs/overview/quickstart, so all six guide sections keep their paths and need no redirects.Tab rendering needed no new code: the desktop strip in
DocsHeaderis already a port of fumadocs'LayoutHeaderTabs, and the sidebar renders the native tabs dropdown belowlg. Both light up once the root folders exist.CLI and MCP move to Documentation → Usage
They document how you drive BitRouter, not the Cloud REST surface. These URLs do change:
/docs/reference/cli/*/docs/usage/cli/*/docs/reference/mcp/docs/usage/mcpWildcard redirects added, placed above the broader
/docs/referencerules that would otherwise swallow them. All verified returning 308.Two generator fixes carry the most weight
Both would have reverted the refactor at build time, rather than failing loudly:
generate-openapi.mjsrewritesreference/meta.jsonon everyprebuild. It was emitting{title: "Reference", defaultOpen: false}and re-listingcli/mcp— droppingroot: truedeletes the tab. The section meta now comes from aREFERENCE_METAconstant, with a comment explaining why it must keep the flag.generate-cli.mjsstill wrote tocontent/docs/reference/cli/, which would have resurrected the old pages as duplicates.check-docs.mjsandgenerate-supported-tables.mjsalso needed the new paths (the former was crashing on ENOENT).Incidental fixes
lastmodboth rebuilt file paths from slugs. Neither survives a folder group, and both were already wrong for.mdpages since they hardcoded.mdx. Now usepage.path.sm. More significantly,DocsHeaderreplaces fumadocs' header wholesale and never renderedslots.sidebar.trigger. Belowmdthe sidebar is a drawer, and that drawer is the only place the tabs dropdown lives, so the docs nav and the API Reference tab were unreachable on a phone. It now passes the native trigger through a newleadingSlotonWebHeaderBody.Verification
pnpm lint:docspasses (44 docs),pnpm testpasses (83 tests)pnpm buildprerenders 119 doc pagesreference/meta.jsonbyte-identically,root: trueintact, and does not recreatereference/cli/Note for review
The 67 file moves are recorded as pure renames (zero content change). Worth a look at whether
(guide)is the name you want for the group — it shows up in file paths and the GitHub edit links, though never in a URL.🤖 Generated with Claude Code