Navigation and sidebar
Configure the navbar, automatic filesystem navigation, and explicit sidebar trees.
Layout
The default layout is the sidebar layout:
Set layout: "top" to place navigation above the content without the
desktop sidebar.
Collapsed sidebar
On desktop the sidebar can collapse to an icon rail. Hovering or focusing a
group's icon then opens a menu next to the rail with the group's page and its
child pages, including nested groups as submenus, built from the same
navigation data as the expanded sidebar. The current page is highlighted. Use
the arrow keys to move through the menu, Enter to open a page, and Escape
to close it and return to the icon. The mobile sidebar always shows the full
tree and does not use the menu.
Automatic sidebar
The default navigation.sidebar.nav: "auto" mode is filesystem-based. Directories become
categories, pages are ordered by frontmatter, and an index.mdx file acts as
the category overview. Page metadata can add icons and badges:
Set addedAt to the page's publication date in YYYY-MM-DD format. The
default theme uses this metadata to mark recent pages with a small indicator
in the sidebar, making newly added documentation easier to spot.
The frontmatter fields in the example are:
title: The page title shown in headings, navigation, and the document title.order: The page order within its directory or category.categoryOrder(optional): The category order when the page belongs to a directory.icon(optional): The Lucide icon name shown beside the page in the sidebar.badge(optional): A short label displayed with the page in navigation.addedAt(optional): The publication date used for the recent-page indicator.toc(optional): Enables the page's “On this page” table of contents when set totrue.prev(optional): The route of the previous page in the documentation flow.next(optional): The route of the next page in the documentation flow.
Explicit sidebar
Use an explicit tree when the displayed order or grouping should differ from the filesystem:
Every href must point to an existing internal documentation route. Invalid
or external sidebar links fail the build with a clear configuration error.
Omit navigation.sidebar.nav, or set it to "auto", to return to filesystem
navigation.
Sidebar promo card
The default theme can render an optional promotional card below the desktop
“On this page” table of contents. It is disabled unless
navigation.sidebar.promo is configured:
The fields are:
title: The card heading.description: The short supporting message.href: The destination opened by the card action.cta(optional): The action label. It defaults toLearn more.
Remove the promo object to hide the card completely. The card is only
shown on desktop pages that have an “On this page” table of contents.
Top navigation links
External links
Links that point to another origin open in a new tab with target="_blank" and
rel="noopener noreferrer". A link is external when its href is an absolute
http: or https: URL, or a protocol-relative //host URL, on an origin other
than the site's own. Relative paths, #hash links, same-origin absolute URLs and
other schemes such as mailto: or tel: keep opening in the same tab and use
client-side navigation. Links that open a new tab also carry visually hidden
text, (opens in a new tab), for assistive technology; it comes from the
navigation.opensInNewTab site translation.
The rule applies to the navbar and its mobile menu, the logo link, the previous
and next page links, Markdown links and raw <a href> elements in MDX content.
Sidebar entries are always internal documentation routes.
- The site's own origin is the origin of
siteUrl. WithoutsiteUrl, the browser's current origin is used, and server-rendered markup treats every absolutehttp(s)URL as external until the page hydrates. SetsiteUrlso absolute links to your own site stay in the same tab from the first render. - An explicit
externalon a navbar item wins over the rule:external: trueopens even a relative path in a new tab, andexternal: falsekeeps an absolute URL in the same tab. - A raw
<a>in MDX that already setstargetis left unchanged. Raw anchors do not get the hidden text, so describe them in the link text.