The sidebar is one of the main ways readers navigate your site. qwik-docs generates it from the sidebar config in qwik-docs.config.ts, falling back to your content structure when you leave sidebar unset.

Default sidebar

When you omit the sidebar config, qwik-docs generates a sidebar from your content. Top-level pages appear first. Pages in subdirectories are grouped under a heading derived from the top-level directory name. Each entry uses the page's title as its label.

For example, given content served under /docs:

  • content/
    • constellations/
      • andromeda.md
      • orion.md
    • stars/
      • betelgeuse.md

qwik-docs generates two groups, Constellations and Stars, each holding the pages in that directory.

Learn more about autogenerated groups in the autogenerated links section.

To configure your sidebar links and groups, set the sidebar property in qwik-docs.config.ts.

Unlike Astro Starlight, a sidebar entry is one of three shapes:

  • A link — an object with label and link.
  • A group — an object with label and items.
  • An autogenerated group — an object with label and autogenerate.

There is no slug entry shape and no bare-string shorthand. Every entry names its label explicitly, and every link states its full URL path in link.

Add a link with label and link. link is a URL path — a page on this site, or an external URL.

export default defineConfig({
	sidebar: [
		// A link to a page on this site.
		{ label: 'Meteor Store', link: '/shop/' },
		// An external link to the NASA website.
		{ label: 'NASA', link: 'https://www.nasa.gov/' },
	],
});

Root-relative link paths are rewritten under the deploy base, so they resolve when the site is served from a subfolder. External URLs and anchors are left untouched.

Groups

Group related links under a collapsible heading. Add a group with label and items. The label is the heading. items holds links or sub-groups, so groups nest to any depth.

export default defineConfig({
	sidebar: [
		{
			label: 'Constellations',
			items: [
				{ label: 'Carina', link: '/docs/constellations/carina/' },
				{ label: 'Centaurus', link: '/docs/constellations/centaurus/' },
				// A nested group.
				{
					label: 'Seasonal',
					items: [
						{ label: 'Andromeda', link: '/docs/constellations/andromeda/' },
						{ label: 'Orion', link: '/docs/constellations/orion/' },
					],
				},
			],
		},
	],
});

This site's own config uses the same pattern. For example:

export default defineConfig({
	sidebar: [
		{
			label: 'Guides',
			items: [
				{ label: 'Pages', link: '/docs/guides/pages/' },
				{ label: 'Sidebar Navigation', link: '/docs/guides/sidebar/' },
				{ label: 'Site Search', link: '/docs/guides/site-search/' },
			],
		},
	],
});

qwik-docs can generate a group's links from a directory of your content. This is helpful when you do not want to enter each item by hand.

Add an autogenerated group with label and autogenerate. autogenerate.directory is the slug prefix to collect entries from — the same prefix the collection is served under. Pages are sorted by their frontmatter sidebar.order, then by title.

export default defineConfig({
	sidebar: [
		{
			label: 'Constellations',
			// Generate links from the 'constellations' directory.
			autogenerate: { directory: 'constellations' },
		},
	],
});

Given content served under those slugs:

  • content/
    • constellations/
      • carina.md
      • centaurus.md
      • seasonal/
        • andromeda.md

qwik-docs collects every page whose slug starts with constellations/ into the group, recursing into subdirectories. Each subdirectory becomes a nested sub-group whose label is derived from the directory name, mirroring the directory tree. For the content above, the Constellations group holds the carina and centaurus links plus a Seasonal sub-group containing andromeda. Within each level, entries are sorted by frontmatter sidebar.order, then by title.

Use the sidebar frontmatter field on a page to customize its autogenerated entry.

---
# content/example.md
title: My page
sidebar:
  # Override the sidebar label (defaults to the page title).
  label: Custom sidebar label
  # Sort weight — lower numbers sort higher.
  order: 2
---

Two frontmatter fields take effect in autogenerated groups:

  • label overrides the link label. It defaults to the page title.
  • order sets the sort weight. Lower numbers sort first; pages without order fall back to alphabetical by title.

sidebar.hidden

Set sidebar.hidden to true to exclude a page from the sidebar. It defaults to false.

---
# content/constellations/draft.md
title: Draft page
sidebar:
  hidden: true
---

sidebar.hidden is honored everywhere a page can appear: the default sidebar and every autogenerate group, at any nesting depth. This matches Astro Starlight.

sidebar.badge

Set sidebar.badge to render a badge next to the page's autogenerated link. A bare string uses the default variant.

---
# content/constellations/carina.md
title: Carina
sidebar:
  badge: New
---

To pick a variant, pass an object with text and variant. The variants are note, tip, caution, danger, success, and default.

---
# content/constellations/vela.md
title: Vela
sidebar:
  badge:
    text: Deprecated
    variant: caution
---

The badge renders next to the link in the autogenerated group, matching Astro Starlight.

Badges

Add a badge to any link or group to surface a small marker next to its label. A bare string uses the default variant.

export default defineConfig({
	sidebar: [
		{ label: 'Meteor Store', link: '/shop/', badge: 'New' },
	],
});

To pick a variant, pass an object with text and variant. The variants are note, tip, caution, danger, success, and default.

export default defineConfig({
	sidebar: [
		{
			label: 'Constellations',
			badge: { text: 'Beta', variant: 'caution' },
			items: [
				{ label: 'Carina', link: '/docs/constellations/carina/' },
				{
					label: 'Centaurus',
					link: '/docs/constellations/centaurus/',
					badge: { text: 'Updated', variant: 'tip' },
				},
			],
		},
	],
});

Custom HTML attributes

Add an attrs object to a link to set HTML attributes on the rendered anchor, such as target or rel.

export default defineConfig({
	sidebar: [
		{
			label: 'NASA',
			link: 'https://www.nasa.gov/',
			// Open in a new tab.
			attrs: { target: '_blank', rel: 'noopener' },
		},
	],
});

Internationalization

Provide a per-locale label to translate a link or group heading. In place of a plain string, set label to a map of locale code to label. The active locale selects the string.

export default defineConfig({
	sidebar: [
		{
			// English falls back to 'en'; French uses 'fr'.
			label: { en: 'Constellations', fr: 'Constellations' },
			items: [
				{
					label: { en: 'Getting started', fr: 'Prise en main' },
					link: '/docs/constellations/intro/',
				},
			],
		},
	],
});

qwik-docs threads the active locale through sidebar generation and strips the locale segment from autogenerated slugs, so the same config builds a correctly-labeled sidebar per locale. This matches how Astro Starlight resolves translations.

Collapsing groups

A group is expanded by default. Set collapsed: true to render it closed until the reader opens it.

export default defineConfig({
	sidebar: [
		{
			label: 'Constellations',
			collapsed: true,
			items: [
				{ label: 'Carina', link: '/docs/constellations/carina/' },
				{ label: 'Centaurus', link: '/docs/constellations/centaurus/' },
			],
		},
	],
});

collapsed applies to explicit groups and autogenerated groups. A nested sub-group inherits nothing from its parent — set collapsed on each group you want closed.

qwik-docs flattens the generated sidebar into an ordered list of links and derives each page's previous and next links from its position in that list. Only sidebar links participate — group headings do not. Override or disable these per page with the prev and next frontmatter fields.