Pages and navigation

Writing4 min read|
|

DocsLit generates your site navigation from docslit.json. You control the sidebar structure, page ordering, and pagination through a single configuration file.

The sidebar array in docslit.json defines groups of pages:

{ "sidebar": [ { "group": "Getting started", "pages": ["introduction", "installation", "quickstart"] }, { "group": "Guides", "pages": ["authentication", "deployment", "custom-domains"] } ] }

Each group creates a collapsible section in the sidebar. Pages appear in the order you list them.

Page slugs

Each entry in the pages array is a slug — the filename without the .md extension:

SlugFileSidebar label
introductiondocs/introduction.mdIntroduction
getting-starteddocs/getting-started.mdGetting Started
api-referencedocs/api-reference.mdApi Reference

DocsLit converts kebab-case slugs to title case automatically. To override the sidebar label, use the sidebar_title frontmatter field.

Nested page IDs

You can organize pages in subdirectories within docs/:

{ "sidebar": [ { "group": "API", "pages": ["api/overview", "api/authentication", "api/endpoints"] } ] }

This maps to files at docs/api/overview.md, docs/api/authentication.md, and so on.

Pagination

DocsLit automatically adds previous and next navigation links at the bottom of each page. The order follows the sidebar — the page after the last entry in a group continues to the first page of the next group.

Arrange your pages in the order a new reader would follow. The sidebar defines both navigation and learning path.

Collapsible groups

Each sidebar group is collapsible. Readers can expand or collapse sections to focus on the content that matters to them.

Keyboard navigation

The sidebar supports full keyboard navigation:

KeyAction
Move between sidebar items
EnterNavigate to the selected page
HomeJump to the first item
EndJump to the last item

Filter

The sidebar includes a search filter at the top. Readers type to filter pages by title, making it easy to find pages in large documentation sites.

Table of contents

DocsLit generates a table of contents from ## and ### headings on each page. This appears as a right-side panel on wide screens.

Write descriptive headings that help readers scan the page. Each heading becomes a clickable anchor link.

Active section tracking

The table of contents highlights the current section as readers scroll. A colored guide line follows the active heading, and sub-headings (h3) are visually indented under their parent h2. Clicking a heading highlights it instantly without waiting for the smooth scroll to finish.

Page toolbar

Every page displays a toolbar below the title with actions for Markdown and PDF:

ButtonDescription
Copy as MarkdownCopies the raw Markdown source of the page to your clipboard
View as MarkdownOpens the .md source file in a new browser tab
Save as PDFOpens the browser print dialog with optimized print styles (default when PDFs are not built at deploy time)
Download PDFDropdown with print, chapter download, and full documentation download — shown when you build with --pdf or pdf.enabled

When you run docslit build --pdf, sidebar groups also become downloadable chapter PDFs. See Chapter PDF export.

Next steps