Auto Sidebar
The Auto Sidebar plugin automatically generates navigation and sidebar configuration based on your documentation directory structure and_meta.json files. This eliminates the need to manually maintain navigation config as your documentation grows.
Overview
The plugin scans your documentation directory and:- Extracts navigation configuration from root-level
_meta.jsonfiles - Generates sidebar configuration from subdirectory
_meta.jsonfiles - Automatically extracts page titles from frontmatter or H1 headings
- Supports multiple languages and versions
Configuration
The Auto Sidebar plugin is enabled by default in Doom. You can configure its behavior in yourdoom.config.yml:
Plugin Options
When used programmatically, the plugin accepts these options:Directory Structure
Here’s an example documentation structure:Meta Configuration
Root Navigation (_meta.json)
The root _meta.json defines top-level navigation items:
Sidebar Configuration
Sidebar_meta.json files define the structure within a section:
Meta Item Types
String Format
Simple string references a file by name (extension optional):- Find the file (tries
.mdx,.md,.tsx,.jsx,.ts,.jsextensions) - Extract the title from frontmatter or first H1 heading
- Generate the appropriate link
Object Format
For more control, use the object format:Meta Item Properties
Item type:
file, dir, divider, custom-link, or section-headerFile or directory name (without extension for files)
Display text for the sidebar item. If omitted, extracted from page title.
Custom URL (for
custom-link type)Whether the directory group can be collapsed
Whether the directory group is collapsed by default
Tag to display next to the item (e.g., “New”, “Beta”)
Use dashed line for dividers
Heading levels to include in overview (e.g.,
[2, 3])Additional context for the item
Title Extraction
The plugin automatically extracts page titles from:- Frontmatter
titlefield (highest priority) - First H1 heading in the content
- Filename as fallback
Example
Multi-language Support
Auto Sidebar works seamlessly with multiple languages:Versioning Support
Auto Sidebar also supports versioned documentation:File Extensions
By default, the plugin looks for these extensions:.mdx.md.tsx.jsx.ts.js
Example Configuration
Here’s a complete example showing Auto Sidebar in action:Programmatic Usage
You can also use the Auto Sidebar plugin programmatically:The Auto Sidebar plugin replaces Rspress’s built-in
auto-nav-sidebar plugin automatically.Best Practices
Use Descriptive Names
Choose clear, descriptive file and directory names that make sense in URLs.
Organize Logically
Group related content together in directories with appropriate
_meta.json files.Set Frontmatter Titles
Always set explicit
title fields in frontmatter for better control.Keep Flat When Possible
Avoid deep nesting - aim for 2-3 levels maximum for better user experience.
Troubleshooting
File Not Found Warning
If you see warnings about missing files:- The file exists with one of the supported extensions
- The filename in
_meta.jsonmatches exactly (case-sensitive) - The file is not in an excluded directory
Sidebar Not Updating
If sidebar changes don’t appear: Solution:- Restart the dev server (it watches
_meta.jsonfiles) - Check for syntax errors in your
_meta.jsonfiles - Verify the directory structure matches your meta configuration
Missing Titles
If titles show as filenames: Solution:- Add a
titlefield in the page’s frontmatter - Ensure the page has a first-level heading (
# Title) - Use the
labelproperty in_meta.jsonto override