Pages and navigation

Writing•4 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 section in the sidebar. Pages appear in the order you list them. Instead of listing pages by hand, you can generate the sidebar from your folders.

Page slugs

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

Slug File Sidebar label
introduction docs/introduction.md Introduction
getting-started docs/getting-started.md Getting Started
api-reference docs/api-reference.md Api Reference

The sidebar label is the page's frontmatter title. When a page has no title, DocsLit converts the kebab-case slug to title case. To use a different label in the sidebar, write the entry as an object:

{ "group": "API", "pages": [ "api/overview", { "id": "api/authentication", "title": "Auth" } ] }

To shorten a label for one page without changing its title, set sidebar_title in the page's frontmatter. The sidebar (explicit and autogenerated) and the previous/next links use it. The page title, heading and browser tab keep title. An object entry with a title in docslit.json still wins over both.

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.

Every entry in a group's pages array is one of three things: a page, a link, or a nested group.

Pages

A page is a string id, or an object when you want to customize how it appears:

{ "group": "Guides", "pages": [ "guides/overview", { "id": "guides/webhooks", "title": "Webhooks", "icon": "webhook", "tag": "New" }, { "id": "guides/streaming", "availability": "beta" }, { "id": "guides/legacy-auth", "deprecated": true }, { "id": "guides/internal-notes", "hidden": true } ] } The page id: its path under docs/ without the extension. The sidebar label. Alias: label. An icon before the label: a Lucide or Font Awesome name, an emoji or an image path. See Icons. Badge text shown after the label, such as New. Alias: badge. A status badge: beta, alpha, preview, experimental, pre-release, in-development, new, deprecated or legacy. stable and generally-available show nothing. Any other text is shown as a plain badge. Strike through the label and add a Deprecated badge. Build and link the page but leave it out of the sidebar. See Hidden pages.

The same keys work in a page's frontmatter as icon, badge, availability, deprecated, hidden and sidebar_title. Frontmatter wins over the sidebar entry, except for title. See Frontmatter.

In frontmatter, tag is the category label in the page header. The sidebar badge is badge. In docslit.json sidebar entries, tag and badge both mean the sidebar badge.

An entry with an href instead of an id is a link. Use it for a status page, a changelog on another domain or any non-doc destination:

{ "href": "https://status.example.com", "title": "Status page", "icon": "activity" }

External links open in a new tab and show an arrow. A link accepts title (or label), icon, tag, external and target.

Nested groups

A group can contain other groups. Use an object with group and pages in place of a page id:

{ "group": "Guides", "icon": "book-open", "pages": [ "guides/overview", { "group": "Advanced", "pages": ["guides/advanced/tuning", "guides/advanced/security"] } ] }

Groups accept the same icon, tag, availability and hidden keys as pages, plus:

Makes the group collapsible. true starts it closed, and false or "open-by-default" starts it open. A group without the key is a plain heading that is always open. The inverse of collapsed: true makes the group collapsible and open. It exists so configs ported from other platforms keep working. A page id that the group title links to. The page is listed first and is not repeated in the group. Fill the group from a folder. See Autogenerated sidebars.

Collapsible groups

{ "group": "Reference", "collapsed": true, "pages": ["reference/api", "reference/cli"] }

The group that holds the current page always opens, and the reader's choices are remembered in their browser. Generated groups can be collapsed too. See Autogenerated sidebars.

Some platforms collapse nested groups by default. DocsLit does not. Set collapsed: true on a nested group when you want that. The importer does this for you.

Hidden pages

A hidden page is built and reachable by its URL, but it is left out of the sidebar, search, llms.txt and the sitemap, and it gets a noindex tag. Use it for landing pages you link to directly, drafts you share by link, or pages that belong to a campaign.

You can hide a page two ways: "hidden": true on its sidebar entry, or hidden: true in its frontmatter. A page with hidden: true in its frontmatter is built even when no sidebar lists it. If the site uses tabs, name the tab it belongs to with tab: Reference in the frontmatter, or it joins the tab whose path covers it, or else the first tab.

You can also hide a whole group with "hidden": true on the group.

Keyboard navigation

The sidebar supports full keyboard navigation:

Key Action
↑ ↓ Move between sidebar items
Enter Navigate to the selected page
Home Jump to the first item
End Jump 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.

Page layouts

Each page uses the guide layout unless you choose another with layout in its frontmatter. Layouts change the column width, and whether the sidebar and table of contents appear:

--- title: API reference layout: wide ---
Layout Aliases What you get
guide default Text column with a table of contents (the default)
overview A wider column with a table of contents
wide reference A wide column and the sidebar, without the table of contents
center page A centered column without the sidebar or table of contents
frame The sidebar with full-width content
full custom, landing A blank canvas for landing pages: no sidebar, table of contents, breadcrumbs or pagination
api Three columns with an examples panel, set by docslit openapi scaffold

Per-page switches such as hide_toc, toc_depth, hide_nav and hide_actions, and the site-wide layout settings for widths, are on Page layout.

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. Use toc_depth or the site layout.tocDepth setting to include deeper headings, and hide_toc to turn it off for a page.

Write descriptive headings that help readers scan the page. Each ##, ### and #### heading also shows a link icon on hover. Click it to copy a direct link to that section.

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:

Button Description
Copy page A split button: the main action copies the page as Markdown, and the dropdown holds the other contextual menu options, such as opening the page in an AI assistant
Save as PDF Opens the browser print dialog with optimized print styles (default when PDFs are not built at deploy time)
Download PDF Dropdown with print, chapter download, and full documentation download, shown when you build with --pdf or pdf.enabled

Hide the toolbar on one page with hide_actions: true. When you run docslit build --pdf, sidebar groups also become downloadable chapter PDFs. See Chapter PDF export.

Next steps