DocgoDocgo
Latest
/Advanced

Versioning

Manage multiple documentation versions, clean versioned URLs, and release snapshots.

Docgo supports documentation versions with folder-based source organization and config-driven switchers.

Configure versions

docgo.config.mjs
export default defineConfig({
  versioning: {
    defaultVersion: 'latest',
    versions: [
      { code: 'latest', label: 'Latest' },
      { code: 'v1', label: 'v1' },
    ],
  },
});

The default version is omitted from URLs. Non-default versions are added as a path prefix.

Source structure

versioned source tree
docs/
  en/
    latest/
      index.mdx
      guide/getting-started.mdx
    v1/
      index.mdx
      guide/getting-started.mdx

URL behavior

Source fileRoute
docs/en/latest/index.mdx/
docs/en/latest/guide/start.mdx/guide/start
docs/en/v1/index.mdx/v1
docs/en/v1/guide/start.mdx/v1/guide/start

Locale prefixes are added before version prefixes when both are non-default:

localized version route
docs/ko/v1/guide/start.mdx -> /ko/v1/guide/start

Snapshot a release

When the current latest docs are ready to freeze, run:

npx docgo version v1

The command copies each locale's default-version directory into the new version directory.

snapshot output
docs/en/latest -> docs/en/v1
docs/ko/latest -> docs/ko/v1

Safety behavior

The version command:

  • requires a version name
  • accepts letters, numbers, dots, dashes, and underscores
  • refuses names already present in versioning.versions
  • refuses to overwrite existing target folders
  • skips locales that do not have default-version content
  • does not edit docgo.config.mjs

After snapshotting, add the new version to config manually.

docgo.config.mjs
versioning: {
  defaultVersion: 'latest',
  versions: [
    { code: 'latest', label: 'Latest' },
    { code: 'v1', label: 'v1' },
  ],
}

Version switcher

The version switcher tries to keep the reader on the same content page. If the target version does not have that page, Docgo falls back to the target version's index page when available.

Shared navigation

nav, sidebar, and footer links are content-relative, so one config can serve all versions.

sidebar item
{ text: 'Getting Started', link: '/guide/getting-started' }

This resolves to /guide/getting-started in latest and /v1/guide/getting-started in v1.

Edit this page

Last updated: