zudo-doc
GitHub repository

Type to search...

to open search from anywhere

How to Structure Navigations

CreatedApr 27, 2026Takeshi Takatsudo

Best practices for organizing header navigation and sidebar categories

Overview

zudo-doc uses a 3-level navigation hierarchy to organize content:

  1. Header navigation β€” the broadest, top-level categories visible across the entire site
  2. Sidebar β€” the next level of categorization within each header nav section
  3. 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/content/docs/ 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 categoryMatch field 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" },
  ],
};

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 sidebar_position.
  • Keep nesting to 2–3 levels max β€” deeply nested sidebars are hard to navigate and often signal that content needs reorganization.
  • Set sidebar_position on 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:

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 set sidebar_position for predictable navigation.
  • Missing index.mdx in category directories β€” without an index, the category has no landing page and may not appear correctly in the sidebar.
  • Using multi-segment categoryMatch values (e.g. "platforms/xbox") β€” categoryMatch must 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 categoryMatch values to actual directory names β€” a categoryMatch: "guides" must correspond to a src/content/docs/guides/ directory.
  • Always create index.mdx for every category directory β€” this ensures the category has a proper landing page and sidebar entry.
  • Set sidebar_position on 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.

Revision History

AI Assistant

Ask a question about the documentation.