Search Documentation

Search for pages and headings in the documentation

Multi-Level Nesting

Multi-level nesting means groups nested 3+ levels deep. Use this when your documentation has complex hierarchies.

Deep Nesting Structure

Level 0 (Root)
└── Level 1 Group
    └── Level 2 Subgroup
        └── Level 3 Subsubgroup
            └── Entries (Pages)

Depth: 4 levels from root to pages. Can be even deeper.

Configuration Example

export const SIDEBAR_NAVIGATION = {
    platform: {
        defaultTab: { label: "Platform", icon: "πŸš€" },
        groups: [
            {
                id: "platform-suite",
                label: "Platform Suite",
                groups: [
                    {
                        id: "core-services",
                        label: "Core Services",
                        groups: [
                            {
                                id: "authentication",
                                label: "Authentication",
                                groups: [
                                    {
                                        id: "oauth",
                                        label: "OAuth 2.0",
                                        autoGenerated: true,
                                    },
                                    {
                                        id: "saml",
                                        label: "SAML",
                                        autoGenerated: true,
                                    },
                                ],
                            },
                            {
                                id: "data-storage",
                                label: "Data Storage",
                                groups: [
                                    {
                                        id: "databases",
                                        label: "Databases",
                                        autoGenerated: true,
                                    },
                                    {
                                        id: "caching",
                                        label: "Caching",
                                        autoGenerated: true,
                                    },
                                ],
                            },
                        ],
                    },
                    {
                        id: "integrations",
                        label: "Integrations",
                        groups: [
                            {
                                id: "third-party",
                                label: "Third-Party Services",
                                groups: [
                                    {
                                        id: "payments",
                                        label: "Payment Processors",
                                        autoGenerated: true,
                                    },
                                    {
                                        id: "analytics",
                                        label: "Analytics Providers",
                                        autoGenerated: true,
                                    },
                                ],
                            },
                        ],
                    },
                ],
            },
        ],
    },
};

Depth: 6 levels from root to pages.

File Organization for Deep Nesting

Folder structure mirrors navigation depth:

content/platform/
└── platform-suite/                 <- Level 1
    β”œβ”€β”€ core-services/              <- Level 2
    β”‚   β”œβ”€β”€ authentication/          <- Level 3
    β”‚   β”‚   β”œβ”€β”€ oauth/               <- Level 4
    β”‚   β”‚   β”‚   β”œβ”€β”€ getting-started.md
    β”‚   β”‚   β”‚   β”œβ”€β”€ setup.md
    β”‚   β”‚   β”‚   β”œβ”€β”€ troubleshooting.md
    β”‚   β”‚   β”‚   └── examples.md
    β”‚   β”‚   └── saml/                <- Level 4
    β”‚   β”‚       β”œβ”€β”€ overview.md
    β”‚   β”‚       β”œβ”€β”€ integration.md
    β”‚   β”‚       └── federation.md
    β”‚   └── data-storage/            <- Level 3
    β”‚       β”œβ”€β”€ databases/           <- Level 4
    β”‚       β”‚   β”œβ”€β”€ postgresql.md
    β”‚       β”‚   β”œβ”€β”€ mongodb.md
    β”‚       β”‚   └── performance.md
    β”‚       └── caching/             <- Level 4
    β”‚           β”œβ”€β”€ redis.md
    β”‚           β”œβ”€β”€ memcached.md
    β”‚           └── strategies.md
    └── integrations/                <- Level 2
        └── third-party/             <- Level 3
            β”œβ”€β”€ payments/            <- Level 4
            β”‚   β”œβ”€β”€ stripe.md
            β”‚   β”œβ”€β”€ paypal.md
            β”‚   └── webhook-handling.md
            └── analytics/           <- Level 4
                β”œβ”€β”€ google-analytics.md
                β”œβ”€β”€ mixpanel.md
                └── event-tracking.md

Resulting Breadcrumbs

Navigation paths get long but clear:

Home > Platform > Core Services > Authentication > OAuth > Getting Started
Home > Platform > Core Services > Data Storage > Databases > PostgreSQL
Home > Platform > Integrations > Third-Party > Payments > Stripe

Users understand exactly where they are.

When to Use Multi-Level Nesting

Good use cases:

  • Enterprise software with many subsystems
  • Complex APIs with multiple service tiers
  • Large platforms with distinct areas
  • Organizations with clear hierarchical structure

Examples:

🏒 Enterprise Platform
β”œβ”€ Account Management
β”‚  β”œβ”€ User Management
β”‚  β”‚  β”œβ”€ SAML
β”‚  β”‚  β”œβ”€ OAuth
β”‚  β”‚  └─ LDAP
β”‚  β”œβ”€ Organization
β”‚  β”‚  β”œβ”€ Teams
β”‚  β”‚  β”œβ”€ Permissions
β”‚  β”‚  └─ Roles
β”‚  └─ Billing
β”‚     β”œβ”€ Subscriptions
β”‚     β”œβ”€ Invoices
β”‚     └─ Payments
└─ Integrations
   β”œβ”€ Marketplace
   β”‚  β”œβ”€ Discovery
   β”‚  β”œβ”€ Installation
   β”‚  └─ Publishing
   └─ Webhooks
      β”œβ”€ Setup
      β”œβ”€ Events
      └─ Best Practices

Deep nesting creates collapsible sections:

β–Ό Platform Suite
  β–Ό Core Services
    β–Ό Authentication (Current Section)
      β–Ό OAuth
        β€’ Getting Started (Current Page)
        β€’ Setup
        β€’ Troubleshooting
        β€’ Examples
      β€’ SAML
    β–Ό Data Storage
      β€’ Databases
      β€’ Caching
  β–Ό Integrations
    β–Ό Third-Party
      β€’ Payments
      β€’ Analytics

Users expand sections to explore. Collapses keep sidebar clean.

Auto-Generation at Each Level

{
    id: "services",
    label: "Services",
    groups: [
        {
            id: "core",
            label: "Core",
            autoGenerated: false,  // Manual control
            groups: [
                {
                    id: "auth",
                    label: "Authentication",
                    autoGenerated: true,  // Auto-discover all files
                    groups: [
                        {
                            id: "methods",
                            label: "Methods",
                            autoGenerated: true,  // Auto-discover all files in subdirs
                        },
                    ],
                },
            ],
        },
    ],
}

Flexible mixing:

  • Some levels auto-generated
  • Some levels manual
  • Choose per level what makes sense

Files in services/core/auth/methods/ appear automatically under Methods subgroup.

Performance Considerations

Deep nesting affects:

Navigation rendering: More levels = more DOM nodes = slight performance cost User experience: Too many clicks to reach content

Recommendations:

  • Maximum 4-5 levels before getting cumbersome
  • Beyond 5 levels, consider redesign
  • Use tabs to split into 2-3 collections instead

Width Constraints

Deeply nested labels can wrap:

Home > Platform Suite > Core Services > Authentication > OAuth > Getting Started

Keep group labels short (2-3 words):

  • βœ… β€œOAuth 2.0” not β€œOAuth 2.0 Authentication Protocol”
  • βœ… β€œUser Mgmt” not β€œUser Management System”
  • βœ… β€œPayments” not β€œPayment Processing Integration”

Comparison: When to Use What

Simple (No nesting):
❌ 100+ pages in flat list
βœ… < 20 pages, simple structure

Single-Level (1 level deep):
βœ… 30-100 pages with clear categories
βœ… Most documentation
βœ… 2-3 organizational layers

Multi-Level (3+ levels deep):
βœ… 200+ pages with complex structure
βœ… Enterprise software
βœ… Clear hierarchical system
❌ Might indicate need for multiple collections

Multiple Collections (separate sites):
βœ… Different audiences
βœ… Independent teams
βœ… Different navigation styles
βœ… Instead of extremely deep nesting

Migration Path

Starting simple and growing deep:

Step 1: Start flat
docs/
β”œβ”€ intro.md
β”œβ”€ setup.md
β”œβ”€ guide.md

Step 2: Add single-level
docs/
β”œβ”€ getting-started/
β”‚  β”œβ”€ intro.md
β”‚  └─ setup.md
└─ guides/
   └─ guide.md

Step 3: Add multi-level
docs/
β”œβ”€ getting-started/
β”‚  β”œβ”€ quick/
β”‚  β”‚  β”œβ”€ intro.md
β”‚  β”‚  └─ setup.md
β”‚  └─ detailed/
β”‚     β”œβ”€ prerequisites.md
β”‚     └─ configuration.md
└─ guides/
   β”œβ”€ basic/
   β”‚  └─ guide.md
   └─ advanced/
      └─ guide.md

Configuration grows with folders. No migration neededβ€”just add nesting as content grows.

Next Steps