Documentation sidebar

Documentation sidebar is the generated left-rail navigation for /docs/. It exposes the documentation hierarchy, keeps the current branch open, and marks the current page without taking space from the article with a right-side table of contents.

This page renders the component live in the rail to its left.

Example#

Variants#

  • The docs root is a dedicated Overview group; pages carrying docs_overview_link: true appear beneath it
  • Depth 0 uses uppercase group labels; nested groups and pages use the same compact row treatment
  • Active branches render open; the current page adds aria-current="page" and the accent marker

When to use#

  • Once in the documentation shell, on pages under /docs/
  • To browse the documentation tree and move between sibling sections or pages
  • Never as a page-level table of contents or as a general site-navigation replacement

Compared with Anchor index#

AspectDocumentation sidebarAnchor index
ScopeThe documentation tree across pagesRepeated sections of the current page
Data sourceHugo sections and pagesA caller-supplied items slice
DestinationLocalized page URLsFragment identifiers such as #accessibility
DisclosureNative <details> state; the active branch starts openNo disclosure state
JavaScriptNoneNone
Appropriate usePersistent docs orientationShortcuts within a long, structured page

Neither component filters content. A filter row changes what appears; these components only move the reader to content that already exists.

Implementation#

layouts/partials/docs/shell.html provides the docs section and the current page, then calls the sidebar once:

{{ partial "docs/sidebar.html" (dict "Page" . "Sections" $sections) }}

sidebar.html renders the Overview group and every top-level docs section. sidebar-section.html recurses through descendant sections and regular pages. The shell supplies top-level sections in weight order; nested items are sorted by title. A section that contains the current page begins with its native <details> element open.

CSS in assets/css/site.css supplies the sticky, scrollable rail; the depth, disclosure, and active-state treatment; and the compact small-screen layout. The navigation landmark name comes from the brandDocsSidebarLabel i18n key. Each native summary contains plain text and a decorative chevron; the first link in its panel leads to the section overview.

Interface manifest

Kind
Component
Category
Navigation
Status
Implemented
Implementation
Partial:layouts/partials/docs/sidebar.htmllayouts/partials/docs/sidebar-section.htmlCSS:assets/css/site.cssi18n:brandDocsSidebarLabelbrandDocsOverviewbrandDocsSectionOverview
Used by
layouts/partials/docs/shell.html

Accessibility#

  • The <nav> carries the localized brandDocsSidebarLabel, distinguishing this navigation landmark from the header navigation, language switcher, and breadcrumb
  • Sections use native <details> and <summary> rather than custom disclosure ARIA; the active branch is open in the rendered HTML
  • A summary does not contain a link or another interactive descendant; the section-overview link is the first item in the disclosed panel
  • Every destination is a regular link; the current page carries aria-current="page" and the accent marker is visual reinforcement only
  • The chevron SVG is aria-hidden="true"; it does not add a redundant announcement to the section label
  • Keyboard users can follow links in reading order and use the native disclosure control to open or close a section