Skip to main content

Versioning

You can use the versioning CLI to create a new documentation version based on the latest content in the docs directory.
That specific set of documentation will then be preserved and accessible even as the documentation in the docs directory continues to evolve.

Versioning is most useful for projects with high traffic and frequent changes between releases. If your docs rarely change, avoid versioning to keep things simple.

Overview​

A typical versioned documentation structure looks like this:

website
β”œβ”€β”€ sidebars.json # sidebar for the current docs version
β”œβ”€β”€ docs # docs directory for the current docs version
β”‚ β”œβ”€β”€ foo
β”‚ β”‚ └── bar.md # https://mysite.com/docs/next/foo/bar
β”‚ └── hello.md # https://mysite.com/docs/next/hello
β”œβ”€β”€ versions.json # list of available versions
β”œβ”€β”€ versioned_docs
β”‚ β”œβ”€β”€ version-1.1.0
β”‚ β”‚ └── hello.md # https://mysite.com/docs/hello
β”‚ └── version-1.0.0
β”‚ └── hello.md # https://mysite.com/docs/1.0.0/hello
β”œβ”€β”€ versioned_sidebars
β”‚ β”œβ”€β”€ version-1.1.0-sidebars.json
β”‚ └── version-1.0.0-sidebars.json
└── docusaurus.config.js
File PathVersionURL
versioned_docs/version-1.0.0/hello.md1.0.0/docs/1.0.0/hello
versioned_docs/version-1.1.0/hello.md1.1.0 (latest)/docs/hello
docs/hello.mdcurrent/docs/next/hello

Terminology​

  • Current version – The content stored in the ./docs folder.
  • Latest version – The version served by default on /docs. This is defined by navigation, not by file location.

These may or may not be the same.

Tutorials​

Tagging a new version​

  1. Prepare the ./docs folder for release.
  2. Run the versioning command:
npm run docusaurus docs:version 1.1.0

This will:

  • Copy the docs/ folder into versioned_docs/version-1.1.0/.
  • Create a versioned sidebar file versioned_sidebars/version-1.1.0-sidebars.json.
  • Append 1.1.0 to versions.json.

Creating new docs​

docs/new.md
# Edit sidebar.js for the current version

Updating an existing version​

Simply edit the files inside the appropriate versioned_docs directory and commit the changesβ€”they will apply only to that version.


Deleting a version​

  1. Remove it from versions.json.
  2. Delete the corresponding versioned_docs and versioned_sidebars directories.

Configuring behavior​

Key plugin options:

  • disableVersioning – Force-disable versioning.
  • includeCurrentVersion – Decide if the ./docs folder should be published.
  • lastVersion – Control which version /docs points to.
  • onlyIncludeVersions – Deploy only a subset of versions.
  • versions – Customize labels, paths, banners, badges, etc.

Example: treating current as a released version:

docusaurus.config.js
export default {
presets: [
'@docusaurus/preset-classic',
{
docs: {
lastVersion: 'current',
versions: {
current: {
label: '1.0.0',
path: '1.0.0',
},
},
},
},
],
};

Docusaurus provides built-in navbar types:

These automatically resolve the best version to display.

  • Version only when necessary – avoid cutting versions for small patch releases.
  • Keep versions manageable – aim for fewer than ~10 active versions.
  • Use absolute imports with @site alias to avoid broken paths across versions.
  • Link docs by file paths (.md), letting Docusaurus rewrite URLs correctly.
  • Decide asset strategy – store images/files either in versioned folders (for frozen snapshots) or in /static for shared use.

By following these guidelines, you can maintain a clean and scalable documentation workflow while supporting multiple versions of your project.