How to Structure Navigations
Best practices for organizing header navigation and sidebar categories
Overview
zudo-doc uses a 3-level navigation hierarchy to organize content:
- 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.
File Structure = Navigation Structure
π Key Principle
In zudo-doc, your file and directory structure directly becomes your navigation. 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, nested dropdowns), 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.
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β).
- 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
// src/config/settings.ts
export const settings = {
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 itssidebar_position. - Keep nesting to 2β3 levels max β deeply nested sidebars are hard to navigate and often signal that content needs reorganization.
- 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.
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
βββ Community
When a user clicks βXboxβ in the Platforms dropdown, the sidebar shows:
Sidebar (Xbox section):
βββ Overview (index)
βββ Hardware
β βββ Xbox Series X
β βββ Xbox Series S
β βββ Accessories
βββ Games
β βββ Halo Infinite
β βββ Forza Horizon 5
β βββ Starfield
βββ Services
βββ 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.
// src/config/settings.ts
export const settings = {
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 β "Overview"
β βββ 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 makes content hard to find. Flatten your structure by splitting into separate header nav sections.
- 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 β without an index, the category has no landing page and may not appear correctly in the sidebar. - 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:
- 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 ensures the category has a proper landing page and sidebar entry. - 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.