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
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
docs/
en/
latest/
index.mdx
guide/getting-started.mdx
v1/
index.mdx
guide/getting-started.mdxURL behavior
| Source file | Route |
|---|---|
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:
docs/ko/v1/guide/start.mdx -> /ko/v1/guide/startSnapshot a release
When the current latest docs are ready to freeze, run:
npx docgo version v1The command copies each locale's default-version directory into the new version directory.
docs/en/latest -> docs/en/v1
docs/ko/latest -> docs/ko/v1Safety 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.
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.
{ text: 'Getting Started', link: '/guide/getting-started' }This resolves to /guide/getting-started in latest and
/v1/guide/getting-started in v1.
