How to Structure Navigations
Best practices for organizing header navigation and sidebar categories
Overview
zudo-doc sites usually organize content in three levels:
Header navigation — the broadest, top-level categories visible across the entire site
Sidebar — the next level of categorization within each header nav section
Nested sidebar categories — detailed subcategories inside sidebar sections
Each level narrows the scope. The header gives users a high-level map of the site, the sidebar breaks a section into logical groups, and nested categories add fine-grained structure where needed.
Three levels is a usability recommendation, not a technical limit. The sidebar is recursive and renders any depth, but shallow trees are easier to scan.
Recommended Sidebar Boundary
Use each major category landing page as the top of its sidebar. Keep the linked category row and all its native descendants visible on both the landing page and its articles. Use the header to switch between major categories. A whole-site sidebar mixes unrelated sections and is usually appropriate only when the documentation is small enough to scan as one tree.
Set scopeRoot: "configured" for each header section, keeping items: [] to use its filesystem tree:
import type { SidebarsConfig } from "@takazudo/zudo-doc/sidebar-utils";
const sidebars: SidebarsConfig = {
guides: { items: [], scopeRoot: "configured" },
reference: { items: [], scopeRoot: "configured" },
};
export default sidebars;Bind this file through chromeBindings.sidebarsConfig and chromeBindingsModule as shown in Sidebar Configuration. The keys must match the header's categoryMatch values. This is the recommended authoring setup; omitting a definition still uses the package's broader editorial default.
For example, a CLI section starts with its linked CLI row and its pages. Broaden tree is absent at that section root, so readers cannot expand it into the other major categories. The same boundary applies in the mobile drawer.
Further branch focus and narrowing are useful when a category is large, deeply structured, or contains substantial nested groups. For a short, flat category, keep the whole category visible; do not add a narrower initialPath just to expose those controls. With the configured boundary, readers who focus a nested branch can broaden back to the major category, but no further. See Capping the Broadening Boundary.
Choosing a Navigation Pattern
Start with the first row. Move down the table only when the default cannot express what readers need.
| Situation | Pattern | Sidebar result | Details |
|---|---|---|---|
| The files already form the hierarchy you want | Filesystem navigation (default): directories with an authored index.mdx | Each category is a linked row with its pages as children | This page |
| A group is only a label and has no landing page | category_no_page: true on its index.mdx, or a synthetic type: "category" item | Heading-only row (not a link) | Sidebar |
| Existing linked groups should appear one level shallower | Sidebar configuration with initialPath | The section's linked child groups become the top rows | Sidebar |
| Existing flat or cross-section pages need a hierarchy, and their URLs must not move | Editorial navigation (advanced) | Real pages become the parents of other real pages | Editorial Navigation |
| Several complete sections should sit under one linked landing page in the sidebar | Umbrella tree (advanced) | The landing row is the parent of each section row, with every native descendant | Umbrella Tree |
For a normal category, author an index.mdx for the landing content and metadata, keep the real category node and its native children, and do not wrap it in a synthetic category or repeat the landing page as an "Overview" child. No custom header or sidebar code is needed.
Four Patterns That Look Alike
These four are easy to confuse because each one shows several sections near each other:
Header dropdown — collects independent sections into one header menu. Each section keeps its own sidebar. It creates no sidebar parent.
Shared sidebar hierarchy — one linked landing page is the real parent of other rows, so readers see and broaden to that landing page from every page below it.
Curated editorial tree — the sidebar lists particular pages and cross-links chosen by hand. A listed page from another section stays a leaf (Editorial Navigation).
Umbrella tree — a shared hierarchy whose children are complete native sections. Only the section list is authored; every page and group inside a section appears automatically (Umbrella Tree).
This showcase's Learn menu combines 1 and 4: the header dropdown lists Guides, Components, and Markdown Features, and the sidebar shows them below the linked Learn row.
Before choosing configuration, write down the tree you want and how each destination behaves: which rows are parents, which section owns each page, what a fresh page and Restore show, which branches start open, and how far Broaden tree may go. When the request is to match an existing hierarchy, keep its linked parents and their descendants. Do not flatten it into peer links because the directories happen to be siblings.
File Structure = Navigation Structure
Key Principle
By default, your file and directory structure becomes your navigation. In that default setup there is no separate navigation config to maintain — the sidebar is generated from your src/ directory tree, and header nav items map to top-level directories via categoryMatch.
This means you can understand the entire site navigation just by looking at the file tree. It is equally intuitive for humans reading the repo and for AI tools generating content.
Keep your file structure and navigation structure tightly coupled. If you want a sidebar category called "Hardware," create a hardware/ directory. If you want a header nav item for "Guides," create a guides/ directory and set categoryMatch: "guides". The directory name, the URL path, and the nav label should all align.
This tight coupling is the recommended approach because:
Predictability — you always know where a page will appear in the navigation by looking at where the file lives
No drift — there is no separate config that can get out of sync with the actual content
AI-friendly — AI tools can reliably generate correct navigation by following the directory structure convention
While zudo-doc supports advanced configuration for complex cases (custom sidebar labels, sort overrides, sidebar configuration, editorial trees), the default behavior — directories become categories, files become pages — covers most needs. Start simple and only add complexity when the default mapping is not enough; the table above lists the next steps.
Widening the Home Navigation Grid
The home page turns the same content tree into a category grid. It uses the standard no-sidebar content width by default. For a larger navigation tree, opt into the wider viewport-oriented grid from zfb.config.ts:
zudoDoc({
home: { wide: true },
});This widens both the default-locale home page and every locale-prefixed home page. You do not need to replace the scaffolded pages/ re-export or write a separate locale home route. See Configuration for the complete setting contract.
Hiding a Category from the Home Grid
zudoDoc({
siteTreeNavIgnore: ["inbox", "develop"],
});This hides those top-level categories from /, locale homes, and <SiteTreeNav />; see Configuration for the complete contract, including unaffected header nav, sidebar, search, and sitemap.
Demoting a Category to the Secondary Row
zudoDoc({
siteTreeNavSecondary: ["changelog", "claude", "codex"],
});Not every top-level category is a primary reading path. System-level categories such as a long changelog or the generated Claude and Codex resource indexes would fill the home grid with large cards that readers rarely start from. This showcase lists them in siteTreeNavSecondary, which removes them from the grid and shows them as a compact row of chevron links directly under it, in the array's order. They stay one click away from / while the grid keeps its focus on the guides.
If a slug is also in siteTreeNavIgnore, the category is hidden instead. The MDX <SiteTreeNav /> tag ignores this setting. See Configuration for the complete contract.
Header Navigation Rules
The header navigation is the topmost level. It should contain only the broadest categories that define your site's major sections.
Keep it concise — aim for 3–6 items. More than that overwhelms users and clutters the header.
Use dropdowns sparingly — only for closely related sections that belong under a single umbrella (e.g., "Learn" containing "Guides" and "Components"). A dropdown groups header items only; it does not make those sections children of anything in the sidebar.
Each item maps to a content directory — the
categoryMatchfield in your config links a header item to the sidebar content for that section.
Tip
For configuration details, see Header Navigation.
Example Header Config
Header navigation is the headerNav field of your single zudoDoc() config in zfb.config.ts. This dropdown is header-only: Guides and Components keep separate sidebars.
// zfb.config.ts
export default defineConfig(
zudoDoc({
headerNav: [
{ label: "Getting Started", path: "/docs/getting-started", categoryMatch: "getting-started" },
{
label: "Learn",
path: "/docs/guides",
categoryMatch: "guides",
children: [
{ label: "Guides", path: "/docs/guides", categoryMatch: "guides" },
{ label: "Components", path: "/docs/components", categoryMatch: "components" },
],
},
{ label: "Reference", path: "/docs/reference", categoryMatch: "reference" },
],
}),
);Sidebar Structure Rules
The sidebar provides the next level of categorization within each header nav section. It is generated automatically from your directory structure.
Use directories for categories — each directory becomes a collapsible sidebar group.
Every category directory should have an
index.mdx— this serves as the landing page for that category and sets its label andsidebar_position. Without one, a category with pages still gets a generated index page, but its label and position fall back to defaults.Prefer 2–3 levels of nesting — deeply nested sidebars are hard to navigate and often signal that content needs reorganization. This is a recommendation; there is no technical depth limit.
Set
sidebar_positionon every page — this ensures predictable ordering instead of relying on alphabetical defaults.
Tip
For configuration details, see Sidebar.
Directory-to-Sidebar Mapping
src/content/docs/guides/ ← sidebar category "Guides"
├── index.mdx ← category landing (sidebar_position: 0)
├── configuration.mdx ← sidebar_position: 1
├── sidebar.mdx ← sidebar_position: 2
└── header-navigation.mdx ← sidebar_position: 3 Each .mdx file appears as a sidebar item. Subdirectories become nested collapsible categories. The result keeps the real category as a linked row:
Guides (linked to guides/index.mdx)
├── Configuration
├── Sidebar
└── Header Navigation Category Shapes
Most categories are trees: they can contain subdirectories, and their index.mdx is a short landing page with <CategoryNav>. A note tray is the alternative for a top-level, flat sequence such as a journal, course, or notebook. Declare category_shape: "note-tray" on its index.mdx, keep every item directly inside the category, and use <NoteTrayIndex> for its landing-page list. Note trays can be index-ordered or grouped by year or month when every item has a date.
This showcase's Getting Started section is a note tray: its pages form one intentional reading sequence rather than a nested topic tree. See Note Trays for the full declaration and validation contract.
Category Top Page (index.mdx)
Every category directory should have an index.mdx that acts as the landing page for that category. For a regular tree category, keep it minimal: a 1–2 sentence description followed by <CategoryNav>, which automatically renders links to all sibling pages. For a note tray, use <NoteTrayIndex> instead.
---
title: Guides
sidebar_position: 1
---
Step-by-step guides for common zudo-doc tasks.
<CategoryNav category="guides" />The category prop is the directory path relative to the docs root (e.g. "guides" for src/, or "changelog/core" for a nested category). Do not put full documentation content in the index — keep real docs in sibling .mdx files under the same directory. The same brevity rule applies to a note-tray index even though its list component differs.
Concrete Real-World Example
Imagine building a gaming wiki. Here is how you would structure the navigation:
Navigation Plan
Header Nav:
├── Home
├── Platforms ← dropdown
│ ├── Xbox
│ ├── PlayStation
│ └── Nintendo
├── Genres ← dropdown
│ ├── RPG
│ ├── Action
│ └── Strategy
└── CommunityWhen a user clicks "Xbox" in the Platforms dropdown, the sidebar shows:
Sidebar (Xbox section):
Xbox (linked to xbox/index.mdx)
├── Hardware (linked)
│ ├── Xbox Series X
│ ├── Xbox Series S
│ └── Accessories
├── Games (linked)
│ ├── Halo Infinite
│ ├── Forza Horizon 5
│ └── Starfield
└── Services (linked)
├── Game Pass
└── Xbox Live Header Config for Gaming Wiki
Each categoryMatch value must be a single top-level directory name — the framework resolves active state by matching only the first path segment of the current URL.
// zfb.config.ts
export default defineConfig(
zudoDoc({
headerNav: [
{ label: "Home", path: "/docs/home", categoryMatch: "home" },
{
label: "Platforms",
path: "/docs/xbox",
categoryMatch: "xbox",
children: [
{ label: "Xbox", path: "/docs/xbox", categoryMatch: "xbox" },
{ label: "PlayStation", path: "/docs/playstation", categoryMatch: "playstation" },
{ label: "Nintendo", path: "/docs/nintendo", categoryMatch: "nintendo" },
],
},
{
label: "Genres",
path: "/docs/rpg",
categoryMatch: "rpg",
children: [
{ label: "RPG", path: "/docs/rpg", categoryMatch: "rpg" },
{ label: "Action", path: "/docs/action", categoryMatch: "action" },
{ label: "Strategy", path: "/docs/strategy", categoryMatch: "strategy" },
],
},
{ label: "Community", path: "/docs/community", categoryMatch: "community" },
],
}),
);Directory Structure for Gaming Wiki
Each platform and genre gets its own top-level directory so that categoryMatch matches the first URL segment correctly:
src/content/docs/
├── home/
│ └── index.mdx
├── xbox/
│ ├── index.mdx ← the linked "Xbox" row
│ ├── hardware/
│ │ ├── index.mdx
│ │ ├── xbox-series-x.mdx
│ │ ├── xbox-series-s.mdx
│ │ └── accessories.mdx
│ ├── games/
│ │ ├── index.mdx
│ │ ├── halo-infinite.mdx
│ │ ├── forza-horizon-5.mdx
│ │ └── starfield.mdx
│ └── services/
│ ├── index.mdx
│ ├── game-pass.mdx
│ └── xbox-live.mdx
├── playstation/
│ └── index.mdx
├── nintendo/
│ └── index.mdx
├── rpg/
│ └── ...
├── action/
│ └── ...
├── strategy/
│ └── ...
└── community/
└── index.mdx Common Mistakes
Warning
Avoid these pitfalls when setting up navigation:
Putting everything in the header — the header should have only broad categories. If you have 10+ items, most of them belong in the sidebar instead.
Deeply nested sidebars — more than 3 levels of nesting usually makes content hard to find. Consider splitting into separate header nav sections. (This is about readability; the sidebar itself has no depth limit.)
Mixing unrelated topics in one sidebar section — each sidebar section should cover a cohesive area. If "Hardware" and "Community Events" end up in the same sidebar, reconsider your header categories.
Missing
sidebar_position— without it, pages sort alphabetically which often produces a confusing order. Always setsidebar_positionfor predictable navigation.Missing
index.mdxin category directories — the category still gets a generated index page, but its label, position, and landing text are defaults instead of intentional content.Wrapping a category that has a landing page in a synthetic category — a
type: "category"item never links to a page, so the result is an unlinked heading with the landing page repeated as its first child. Keep the real category node instead.Expecting a header dropdown or a list of section pages to create a sidebar parent — dropdown children stay independent sections, and
items: ["learn", "guides", "components"]produces peer leaf links.scopeRootandinitialPathdo not add ancestry either. Use an umbrella tree for that.Using multi-segment
categoryMatchvalues (e.g."platforms/xbox") —categoryMatchmust be a single top-level directory name. Multi-segment values break active-state highlighting in the header nav.
Tips for AI-Assisted Setup
When using AI tools to generate zudo-doc site structures, follow these rules for consistent results:
Write the intended tree first — before choosing configuration, list the parent/child rows and how each destination behaves (owner section, fresh and Restore view, open branches, Broaden ceiling). Choose the pattern from that list, not from the directory layout.
Preserve requested hierarchies — when asked to match an existing sidebar, keep its linked parent rows and their full descendants. Do not replace them with a flat hub of peer links.
Follow the hierarchy strictly — header nav for broad categories, sidebar for subcategories, nested directories for further detail. Never skip a level.
Keep header nav items to broad categories only — resist the urge to add specific pages to the header. That is what the sidebar is for.
Match
categoryMatchvalues to actual directory names — acategoryMatch: "guides"must correspond to asrc/directory.content/ docs/ guides/ Always create
index.mdxfor every category directory — this gives the category an intentional landing page, label, and position.Prefer moving files over configuration — when the wanted hierarchy differs from the directories, change the directories. Use editorial navigation only when existing URLs must stay.
Set
sidebar_positionon every page and index — this is the most common thing AI tools forget, leading to unpredictable ordering.Use kebab-case for directory and file names — consistent naming avoids case-sensitivity issues across platforms.
This page covers designing the tree. Keeping it meaningful as pages accumulate — placement checks, structure reviews, and a project editorial policy shared by people and agents — is covered in Maintaining Documentation Structure.