Versioning
Maintain multiple versions of your documentation side by side using folder conventions and the versions config key.
Versioning lets you keep multiple parallel editions of your documentation active at the same time — one for each major version of your project. Users can switch between them, and older versions remain accessible without any manual maintenance.
Quick Start
Step 1: Add versions to your configuration
export default defineConfig({
versions: {
defaultVersion: 'v2',
versions: [
{ label: 'v2 (latest)', path: 'v2' },
{ label: 'v1', path: 'v1' },
],
},
})
Step 2: Create version folders
mkdir docs/v2 docs/v1
Step 3: Add your versioned content
docs/
├── v2/
│ ├── guide/
│ │ └── index.md → /docs/v2/guide
│ └── api/
│ └── config.md → /docs/v2/api/config
└── v1/
└── guide/
└── index.md → /docs/v1/guide
Configuration Reference
BoltdocsVersionsConfig
| Property | Type | Required | Description |
|---|---|---|---|
defaultVersion | string | ✓ | The version path considered current/default. Pages of this version don't necessarily require their own folder if you want them at the root. |
prefix | string | — | A string prepended to each version's path inside docs/ (e.g. 'v' → folders become docs/v1/, docs/v2/). |
versions | VersionConfig[] | ✓ | The ordered list of available versions. The first item appears first in the version selector. |
VersionConfig
| Property | Type | Required | Description |
|---|---|---|---|
label | string | ✓ | Human-readable label for this version (e.g. 'v2 (latest)'). Displayed in the version selector UI. |
path | string | ✓ | The folder name in docs/ and URL segment for this version (e.g. 'v1'). |
Using a Folder Prefix
If you want all version folders to share a common prefix (e.g. docs/releases/v1/, docs/releases/v2/), configure the prefix option:
export default defineConfig({
versions: {
defaultVersion: 'v2',
prefix: 'releases/',
versions: [
{ label: 'v2 (latest)', path: 'v2' },
{ label: 'v1', path: 'v1' },
],
},
})
This maps docs/releases/v2/guide.md → /docs/releases/v2/guide.
Combining Versioning with i18n
When both versioning and i18n are active, the folder hierarchy is always version first, then locale:
docs/
└── v2/
├── guide.md → /docs/v2/guide (default locale)
└── es/
└── guide.md → /docs/v2/es/guide (Spanish)
The version segment always resolves before the locale segment. Place locale folders inside version folders, not the other way around. The inverse structure (docs/es/v2/) is not supported.
Versioned URLs
Given this configuration:
versions: {
defaultVersion: 'v2',
versions: [
{ label: 'v2', path: 'v2' },
{ label: 'v1', path: 'v1' },
],
}
A file at docs/v1/guide/install.md resolves to /docs/v1/guide/install. A file at docs/v2/guide/install.md resolves to /docs/v2/guide/install.
The version selector in the default layout lets users jump between versions while staying on the equivalent page.