Sidebar and Navigation
Understand how Docstra handles sidebar generation and page navigation.
Docstra provides an automated yet flexible navigation system that makes organizing your documentation effortless.
Auto-Generated Sidebar
By default, Docstra generates the sidebar based on the file structure of your content directory. This means your URLs and navigation hierarchy are always in sync.
Sorting and Naming
To control the order and display names of your sidebar items, you can use prefixes in your filenames:
- Naming: The filename (minus the prefix and extension) is used as the slug. The
titleproperty in the page's frontmatter is used as the display name. - Sorting: Use numeric prefixes (e.g.,
01-intro.mdx,02-setup.mdx) to define a specific order. These prefixes are automatically stripped from the final URL.
Nested Navigation
Folders in your content directory translate into nested sections in the sidebar.
File Structure
Customizing Sidebar
Sidebar Metadata Reference
| Property | Type | Description |
|---|---|---|
title | string | Main title of the page (used for SEO + default sidebar label) |
nav_title | string | Overrides title only in sidebar |
icon | string | Lucide icon name (e.g., NotebookPen) |
description | string | Used for page description / SEO metadata |
defaultOpen | boolean | Automatically expands this section in sidebar |
collapsible | boolean | Enables/disables collapsing of a section |
group_title | string | Title for a folder/group in sidebar (only works on folders index file) |
Example Usage (MDX Frontmatter)
mdx
How It Works (Hierarchy Logic)
title→ fallback display everywherenav_title→ overrides sidebar label onlygroup_title→ applies to folders (sections)icon→ rendered alongside sidebar itemdefaultOpen→ controls initial expand statecollapsible→ locks/unlocks collapse behavior
Pro Tips (Important)
-
Use
nav_titlewhen:- filename is technical but UI should be user-friendly
-
Use
group_titlewhen:- folder name ≠ desired sidebar label
-
Combine
defaultOpen + collapsible=false:- for always-visible important sections
Breadcrumbs
Docstra automatically generates breadcrumb navigation at the top of each page, helping users understand their current location within the documentation hierarchy.
Table of Contents (TOC)
On the right side of each page, a Table of Contents is automatically generated based on the headings (h2 and h3) in your MDX content. It supports:
- Active State: Highlights the section currently in view as the user scrolls.
- Deep Linking: Clickable links that scroll the page to the corresponding section.
How is this guide?
Last updated on March 30, 2026