Sidebar
Configure section sidebars, collapsible groups, prefix matching, prev/next order, and per-locale labels.
The sidebar is configured with the sidebar option in docgo.config.mjs.
export default defineConfig({
sidebar: {
'/guide/': [
{
text: 'Start',
items: [
{ text: 'Getting Started', link: '/guide/getting-started' },
{ text: 'Configuration', link: '/guide/configuration' },
],
},
],
},
});Array sidebar
A sidebar can be a single array when one navigation tree should be used everywhere.
sidebar: [
{ text: 'Home', link: '/' },
{ text: 'Getting Started', link: '/guide/getting-started' },
];Prefix sidebar
An object sidebar lets different content sections use different navigation.
sidebar: {
'/guide/': [{ text: 'Guide', items: [/* ... */] }],
'/api/': [{ text: 'API', items: [/* ... */] }],
'/': [{ text: 'Home', link: '/' }],
}Docgo chooses the longest matching content-path prefix. The / key is the
fallback.
Links
Sidebar links are content-relative.
{ text: 'Getting Started', link: '/guide/getting-started' }Docgo resolves the current locale and version automatically.
Groups
Sidebar items with items become groups.
{
text: 'Reference',
items: [
{ text: 'Config Reference', link: '/guide/config-reference' },
],
}A group can also have a link. In that case the group itself is included in
prev/next navigation.
Collapsible groups
A group becomes collapsible only when the collapsed field is present.
{
text: 'Advanced',
collapsed: true,
items: [
{ text: 'Plugins', link: '/guide/plugins' },
{ text: 'Deployment', link: '/guide/deployment' },
],
}collapsed: truestarts closed.collapsed: falsestarts open.- Omit
collapsedfor an always-open group.
Groups containing the active page are forced open.
Prev and next links
The article footer uses the resolved sidebar order for Previous and Next links. Pages not referenced by the sidebar still build, but they do not participate in prev/next navigation.
Per-locale sidebar
Add sidebar to a locale entry to translate labels.
i18n: {
locales: [
{ code: 'en', label: 'English' },
{
code: 'ko',
label: 'Korean',
sidebar: {
'/guide/': [{ text: 'Guide', items: [/* translated items */] }],
},
},
],
}The locale sidebar fully replaces the top-level sidebar for that locale.
