DocgoDocgo
Latest
/Site Configuration

Nav Menu

Configure header navigation, active states, dropdowns, external links, and locale-aware route resolution.

The nav array controls the header navigation.

docgo.config.mjs
export default defineConfig({
  nav: [
    { text: 'Guide', link: '/guide/getting-started', activeMatch: '/guide/' },
    {
      text: 'Reference',
      items: [
        { text: 'Config Reference', link: '/guide/config-reference' },
        { text: 'Markdown', link: '/guide/markdown' },
      ],
    },
  ],
});
nav: [{ text: 'Guide', link: '/guide/getting-started' }];

link is content-relative unless it is external. For a Korean page, the same link resolves to /ko/guide/getting-started; for version v1, it resolves to /v1/guide/getting-started.

Active states

Docgo marks a nav item active by testing activeMatch against the current content path.

nav: [{ text: 'Guide', link: '/guide/getting-started', activeMatch: '/guide/' }];

If activeMatch is omitted, Docgo falls back to path-prefix matching on link.

Invalid regular expressions are ignored.

Use items for dropdowns.

nav: [
  {
    text: 'Reference',
    items: [
      { text: 'Config Reference', link: '/guide/config-reference' },
      { text: 'CLI', link: '/guide/cli' },
    ],
  },
];

Dropdown entries use the same active-state and route-resolution rules as top-level links.

External links are not rewritten.

nav: [
  { text: 'GitHub', link: 'https://github.com/kyechan99/docgo' },
  { text: 'Support', link: 'mailto:support@example.com' },
];

HTTP and HTTPS links open in a new tab from the header.

The older docs.navbar.links option is still supported as a fallback when nav is empty.

docs: {
  navbar: {
    links: [{ label: 'GitHub', href: 'https://github.com/owner/repo' }],
  },
}

For new sites, prefer nav.

Per-locale nav

Add nav to a locale entry when labels should be translated.

i18n: {
  defaultLocale: 'en',
  locales: [
    { code: 'en', label: 'English' },
    {
      code: 'ko',
      label: 'Korean',
      nav: [{ text: 'Guide', link: '/guide/getting-started' }],
    },
  ],
}

The locale nav fully replaces the top-level nav for that locale.

Edit this page

Last updated: