Nested Setup Best Practices
Nesting groups gives power, but structure matters. Here are best practices to keep your documentation organized and maintainable.
Organization Principles
1. Limit Nesting Depth
β
Good: 3-4 levels max
Home > Docs > Getting Started > Installation
Home > Docs > Features > Authentication > OAuth
β Too deep: 6+ levels
Home > Docs > Features > Core > Auth > Providers > OAuth > Config
Rule: If you need more than 4 levels, consider a separate collection instead.
2. Consistent Folder Structure
Pattern: Folder hierarchy exactly matches navigation configuration.
// Configuration
groups: [
{
id: "core",
label: "Core",
groups: [
{ id: "auth", label: "Auth", autoGenerated: true },
{ id: "data", label: "Data", autoGenerated: true },
],
},
]
// File system (must match)
content/docs/
ββ core/
β ββ auth/ <- matches config
β β ββ overview.md
β β ββ setup.md
β ββ data/ <- matches config
β ββ overview.md
β ββ schemas.md
Never create folders that donβt match your config, or vice versa.
3. Use Meaningful Names
Group IDs should be:
- Short: 2-3 words max
- Descriptive: Clear what they contain
- URL-friendly: No spaces, use hyphens
β
auth, data-models, webhooks, api-reference
β auth-and-authorization, user-management-system, very-detailed-api-docs
Labels (visible to users) can be longer:
{ id: "auth", label: "Authentication & Authorization" }
{ id: "data-models", label: "Data Models & Schemas" }
{ id: "webhooks", label: "Webhooks & Events" }
4. Mix Auto and Manual Strategically
Use auto-generation for:
- Stable content that grows organically
- Categories that frequently get new pages
- User-generated or plugin content
Use manual entries for:
- Fixed sequences (setup steps)
- Curated collections
- External links
- Selective display
// Good: Auto for optional features, manual for required setup
groups: [
{
id: "getting-started",
label: "Getting Started",
autoGenerated: false, // Manual: specific order matters
entries: [
{ slug: "setup/requirements" },
{ slug: "setup/installation" },
{ slug: "setup/configuration" },
],
},
{
id: "plugins",
label: "Plugins",
autoGenerated: true, // Auto: add new plugin docs anytime
},
];
5. Organize by User Journey
Group structure should match how users navigate the product:
β
Task-based
ββ Getting Started
ββ Core Features
ββ Advanced Configuration
ββ Troubleshooting
β Random order
ββ API Reference
ββ Setup
ββ Examples
ββ Architecture
Users progress through sections naturally. No backtracking.
Navigation Patterns
Pattern 1: Feature-Based (Most Common)
Products
ββ Product A
β ββ Installation
β ββ Configuration
β ββ How-To Guides
β ββ API Reference
ββ Product B
β ββ [same structure]
ββ Product C
ββ [same structure]
Use when:
- Multi-product platform
- Each product has independent docs
- Users work with specific product
Pattern 2: Audience-Based
Documentation
ββ For Users
β ββ Getting Started
β ββ How-To Guides
β ββ FAQ
ββ For Developers
β ββ API Reference
β ββ SDK Guides
β ββ Examples
ββ For Operators
ββ Installation
ββ Configuration
ββ Troubleshooting
Use when:
- Different docs for different user types
- Audiences have different needs
- Clear separation of concerns
Pattern 3: Technical Layers
Platform
ββ Frontend
β ββ Components
β ββ Styling
β ββ State Management
ββ Backend
β ββ API
β ββ Database
β ββ Authentication
ββ DevOps
ββ Deployment
ββ Monitoring
ββ Scaling
Use when:
- Technical documentation
- Multiple teams (frontend, backend, ops)
- Clear technical boundaries
Pattern 4: By Complexity
Learning Path
ββ Fundamentals
β ββ What is X
β ββ Why use X
β ββ Getting Started
ββ Intermediate
β ββ Core Concepts
β ββ Practical Examples
β ββ Debugging
ββ Advanced
ββ Architecture
ββ Performance Tuning
ββ Internals
Use when:
- Content has skill progression
- Want to guide users from beginner -> advanced
- Different sections for different expertise levels
Common Mistakes to Avoid
Mistake 1: Over-Nesting
β Too deep
Home > Docs > Features > Core > Settings > Advanced > Config > Database > Setup
Fix: Keep max 4 levels. Use tabs or separate collections for different concerns.
Mistake 2: Inconsistent Structure
β Mismatches
Config says: groups.auth.groups.oauth
Folder has: auth/providers/oauth/
Auto-gen fails!
Fix: Folder structure must exactly match configuration.
Mistake 3: Unclear Group Names
β Vague
ββ Category A
ββ Category B
ββ Group 1
ββ Other Stuff
Fix: Use descriptive names that explain content.
Mistake 4: Mixing Organizational Schemes
β Inconsistent
ββ Getting Started (by user journey)
ββ Backend (by layer)
ββ Payment Processing (by feature)
ββ For Developers (by audience)
Fix: Pick one organizing principle and stick with it.
Mistake 5: Auto-Gen in Strict Order
β Doesn't work
Config requires specific order:
1. Prerequisites
2. Installation
3. Configuration
But auto-gen alphabetizes:
1. Configuration
2. Installation
3. Prerequisites
Fix: Use manual entries when order matters.
Maintenance Best Practices
Keep Configuration DRY
// β Repetitive
groups: [
{
id: "docs",
label: "Documentation",
groups: [
{ id: "intro", label: "Introduction", autoGenerated: true },
{ id: "setup", label: "Setup", autoGenerated: true },
{ id: "guide", label: "Guide", autoGenerated: true },
],
},
];
// β
Use helpers
const createAutoGroup = (id, label) => ({ id, label, autoGenerated: true });
groups: [
{
id: "docs",
label: "Documentation",
groups: [
createAutoGroup("intro", "Introduction"),
createAutoGroup("setup", "Setup"),
createAutoGroup("guide", "Guide"),
],
},
];
Document Your Organization
Add a README in content/:
# Documentation Structure
## Getting Started
- Prerequisites, installation, first project
- Order: Manual (sequence matters)
## Features
- Feature-specific guides
- Order: Auto-generated (alphabetical)
## API Reference
- Endpoint documentation
- Order: Manual (grouped by resource)
## Advanced
- Performance, security, internals
- Order: Auto-generated
Plan Before Building
Step 1: Sketch on paper
ββ Top-level sections (tabs)
ββ Main groups
ββ Subgroups
ββ Number of pages per section
Step 2: Create folder structure
mkdir -p content/docs/section/subsection
Step 3: Write configuration
Add to data/config.ts
Step 4: Create content files
Add .md files to folders
Step 5: Test in dev server
Verify navigation matches intent
Scaling Guidelines
| Documentation Size | Recommended Structure | Max Depth |
|---|---|---|
| < 20 pages | Single level or no nesting | 2 |
| 20-50 pages | Single-level nesting | 2-3 |
| 50-150 pages | Single/multi-level nesting | 3-4 |
| 150+ pages | Multiple collections recommended | - |
As docs grow, consider splitting into separate collections rather than deeper nesting.
Real-World Example
Company: SaaS platform with 3 products Users: End users, developers, operators Content: 200+ pages
Structure:
export const SIDEBAR_NAVIGATION = {
// Collection 1: User docs
"user-docs": {
defaultTab: { label: "Getting Started", icon: "π" },
groups: [
{
id: "basics",
label: "Basics",
groups: [
{ id: "setup", label: "Setup", autoGenerated: true },
{ id: "first-steps", label: "First Steps", autoGenerated: true },
],
},
{
id: "products",
label: "Products",
groups: [
{ id: "product-a", label: "Product A", autoGenerated: true },
{ id: "product-b", label: "Product B", autoGenerated: true },
{ id: "product-c", label: "Product C", autoGenerated: true },
],
},
],
},
// Collection 2: Developer docs
"dev-docs": {
defaultTab: { label: "Getting Started", icon: "π§" },
groups: [
{ id: "api", label: "API Reference", autoGenerated: true },
{ id: "sdks", label: "SDKs", autoGenerated: true },
{ id: "webhooks", label: "Webhooks", autoGenerated: true },
],
},
// Collection 3: Operations
"ops-docs": {
defaultTab: { label: "Setup", icon: "βοΈ" },
groups: [
{ id: "setup", label: "Setup", autoGenerated: false, entries: [...] },
{ id: "monitoring", label: "Monitoring", autoGenerated: true },
{ id: "scaling", label: "Scaling", autoGenerated: true },
],
},
};
Result:
- 3 separate collections (not deeply nested)
- Each serves different audience
- Each can be maintained independently
- Clear organization at all levels
- Maximum 3 levels deep: cleanest UX