Skip to content

The sidebar

The sidebar is set in astro.config.mjs. This template uses one group per folder:

astro.config.mjs
sidebar: [
{ label: 'Start here', items: [{ autogenerate: { directory: 'start-here' } }] },
{ label: 'Writing', items: [{ autogenerate: { directory: 'writing' } }] },
{ label: 'Publishing', items: [{ autogenerate: { directory: 'publishing' } }] },
{ label: 'Reference', items: [{ autogenerate: { directory: 'reference' } }] },
],

Each group’s autogenerate lists every page in that folder, so adding a page is adding a file. The group’s label is what readers see; the directory is the folder under src/content/docs/.

Within an autogenerated group, pages are sorted by sidebar.order in their frontmatter, then alphabetically:

---
title: Installing the CLI
sidebar:
order: 1
---

Create the folder, put a page in it, and add a line to the list:

{ label: 'Guides', items: [{ autogenerate: { directory: 'guides' } }] },

Groups appear in the order they are listed.

When you want full control — or a link to somewhere outside the docs — list the entries yourself instead of autogenerating:

{
label: 'Start here',
items: [
'start-here/introduction',
'start-here/use-this-template',
{ label: 'Changelog', link: 'https://github.com/your-org/your-repo/releases' },
],
},

Pages are named by their path under src/content/docs/, without the extension.

Deployed on One9x Pages