---
title: Pages and navigation
description: Organize your documentation with sidebar groups, icons, badges, hidden pages and external links, and see how pagination and the table of contents work.
tag: Writing
readtime: 4 min read
---
> For AI agents: the complete documentation index is at [llms.txt](https://docs.docslit.com/0.3/llms.txt). This page as Markdown: [writing-content/pages-and-navigation.md](https://docs.docslit.com/0.3/writing-content/pages-and-navigation.md).


# Pages and navigation

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

## Sidebar structure

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

```json filename="docslit.json"
{
  "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](autogenerated-sidebars).

## 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:

```json filename="docslit.json"
{
  "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/`:

```json filename="docslit.json"
{
  "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.

<wc-callout type="tip" title="Logical ordering">
Arrange your pages in the order a new reader would follow. The sidebar defines both navigation and learning path.
</wc-callout>

## Sidebar entries

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:

```json filename="docslit.json"
{
  "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 }
  ]
}
```

<wc-fields header="Page entry">
<wc-field name="id" type="string" required>
The page id: its path under `docs/` without the extension.
</wc-field>
<wc-field name="title" type="string">
The sidebar label. Alias: `label`.
</wc-field>
<wc-field name="icon" type="string">
An icon before the label: a Lucide or Font Awesome name, an emoji or an image path. See [Icons](../components/icons).
</wc-field>
<wc-field name="tag" type="string">
Badge text shown after the label, such as `New`. Alias: `badge`.
</wc-field>
<wc-field name="availability" type="string">
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.
</wc-field>
<wc-field name="deprecated" type="boolean">
Strike through the label and add a Deprecated badge.
</wc-field>
<wc-field name="hidden" type="boolean">
Build and link the page but leave it out of the sidebar. See [Hidden pages](#hidden-pages).
</wc-field>
</wc-fields>

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](frontmatter).

<wc-callout type="note" title="Badge text is badge, not tag">
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.
</wc-callout>

### Links

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:

```json filename="docslit.json"
{ "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:

```json filename="docslit.json"
{
  "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:

<wc-fields header="Group options">
<wc-field name="collapsed" type="boolean | string">
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.
</wc-field>
<wc-field name="expanded" type="boolean">
The inverse of `collapsed`: `true` makes the group collapsible and open. It exists so configs ported from other platforms keep working.
</wc-field>
<wc-field name="root" type="string">
A page id that the group title links to. The page is listed first and is not repeated in the group.
</wc-field>
<wc-field name="autogenerate" type="string | object">
Fill the group from a folder. See [Autogenerated sidebars](autogenerated-sidebars).
</wc-field>
</wc-fields>

### Collapsible groups

```json filename="docslit.json"
{ "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](autogenerated-sidebars#collapsible-groups).

<wc-callout type="note" title="Nested groups are not collapsed for you">
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.
</wc-callout>

### 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](../customization/tabs-and-anchors), 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:

```yaml
---
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](../customization/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](../customization/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](../deployment/chapter-pdf-export).

## Next steps

- Add top-level [tabs and anchors](../customization/tabs-and-anchors) when one sidebar is not enough
- Control widths and per-page switches in [Page layout](../customization/page-layout)
- Generate downloadable manuals with [Chapter PDF export](../deployment/chapter-pdf-export)
- Optimize for search and AI agents with [search and SEO](search-and-seo)
- Start adding components to your pages — begin with [callouts and alerts](../components/callouts-and-alerts)
