# How to version your guides alongside your API versions

> Wire each guides version to an API version and an SDK release in one manifest, put a banner on earlier ones, keep them out of search, and check every version in CI.

Source: https://voxgig.com/howto/version-guides-alongside-api-versions

- Audience: devrel
- Level: intermediate
- Verified: 2026-11-30
- Published: 2026-11-30

## Short answer

Keep one manifest that maps each guides version to its API version, its SDK release, and a status. Build the guides with Docusaurus versioned docs, give every earlier version the `unmaintained` banner and `noIndex`, and send retired versions to the `current` guide with a redirect. A check in CI fails when a page pins another SDK release, calls another API version, or lacks a note every version must carry.

---
## You will need

Node 22 or later, a published API versioning policy, and a guides site in a docs-as-code
toolchain. Verified 2026-11-30 against Node 22.23.5, `@docusaurus/core` 3.10.2, and mike 2.2.0
with `mkdocs` 1.6.1 and `mkdocs-material` 9.8.2 on Python 3.12. The policy decides how many
versions you publish. The site only carries that decision out, so settle the number first.

## Approaches compared

| Approach | When it fits | What it costs you | When to pick something else |
| --- | --- | --- | --- |
| [A branch per version](https://git-scm.com/docs/git-cherry-pick) | Guides that differ a lot between majors, each built and deployed from its own branch | Every shared fix is a cherry-pick per branch, so a branch that missed one stays wrong until someone looks | The versions share most of their pages |
| [Docusaurus versioned docs](https://docusaurus.io/docs/versioning) | A React site with a version dropdown, per-version banners, and `noIndex` in the config | Each `docs:version` copies every page, so one fix lands in every copy | You publish a single version, or the site is not React |
| [Mintlify versions in docs.json](https://www.mintlify.com/docs/organize/navigation) | A hosted site where `navigation.versions` splits the pages and a `tag` labels an entry | Readers get the build Mintlify hosts, and serving it yourself takes `mint export`, an Enterprise plan feature | You serve the guides from your own host without that plan |
| [The mike plugin for MkDocs](https://github.com/jimporter/mike) | MkDocs sites deployed to a `gh-pages` branch, with `latest` as an alias | Earlier versions are frozen builds, so a fix means rebuilding and redeploying that version | Your host does not serve from a branch |

Docusaurus and mike both freeze a version, Docusaurus as source and mike as built HTML, so a
security note added later reaches an earlier version only if you add it there. A branch per version
keeps each major free to differ but turns one fix into one cherry-pick per branch. Mintlify
builds and hosts the site. Its CLI previews it with `mint dev`, and the
[offline export](https://www.mintlify.com/docs/deploy/export) for your own host needs an
Enterprise plan.

## Wire each guides version to an API version

The manifest is the only place the mapping lives. A docs version is a label, an API version is
a path prefix, and an SDK release is the string a reader pastes into a terminal:

```json title="versions.manifest.json"
{
  "sdkPackage": "@pets/sdk",
  "apiBase": "https://api.example.com/",
  "requiredNotes": [
    "Rotate any API key created before 2026-03-01."
  ],
  "versions": [
    {
      "docs": "2.x",
      "api": "v2",
      "sdk": "2.3.1",
      "status": "current"
    },
    {
      "docs": "1.x",
      "api": "v1",
      "sdk": "1.8.4",
      "status": "previous"
    },
    {
      "docs": "0.x",
      "api": "v0",
      "status": "retired",
      "redirect": "/docs/0.x/* /docs/quickstart 301"
    }
  ]
}
```

The Docusaurus config carries the reader-facing half. The
[docs plugin options](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs)
take a `banner` of `none`, `unreleased`, or `unmaintained`, and `noIndex` for each version:

```js title="site/docusaurus.config.js"
        docs: {
          sidebarPath: './sidebars.js',
          lastVersion: 'current',
          versions: {
            current: { label: '2.x', banner: 'none' },
            '1.x': { label: '1.x', path: '1.x', banner: 'unmaintained', noIndex: true },
          },
```

## Check every version against the manifest

`check-versions.mjs` reads the manifest, the config, `versions.json`, every page of every
version, and `static/_redirects`. It needs nothing installed:

```bash
node check-versions.mjs site
```

```text output
2.x  API v2  sdk 2.3.1  1 page  banner none  noIndex false
1.x  API v1  sdk 1.8.4  1 page  banner unmaintained  noIndex true
0.x  API v0  retired, redirect in place
every version is wired to its API and SDK release
```

When the SDK team ships 1.9.0 for API v1 and the manifest moves, the 1.x guide still pins
1.8.4:

```bash
node check-versions.mjs site --manifest fixtures/sdk-bumped.manifest.json
```

```text output
2.x  API v2  sdk 2.3.1  1 page  banner none  noIndex false
1.x  API v1  sdk 1.8.4  1 page  banner unmaintained  noIndex true
0.x  API v0  retired, redirect in place
problem: 1.x: pages pin @pets/sdk@1.8.4, the manifest says 1.9.0
1 problem
```

It exits 1. Bump the manifest in the same pull request as the SDK release, and the check names
every guide that still pins the earlier one.

## Count what a snapshot costs

`docs:version` freezes the `current` docs as a version by copying them. `record.sh` ran it on the
site as committed:

```bash
node show.mjs docs-version
```

```text output
files docs:version 2.x added: versioned_docs/version-2.x/quickstart.md versioned_sidebars/version-2.x-sidebars.json
versions.json after: ["2.x","1.x"]
copies of the security note across the docs trees: 3
```

One security note, three files. That is the trade-off of snapshots: a typo or a security warning
for every version is a change to every copy. The manifest's `requiredNotes` turns a copy you
missed into a failed check, but the edits are still yours.

## Check it worked

The tests break one thing at a time in a scratch copy of the site. A pin, a range pinned
beside it, a note, a banner, `noIndex`, an API path, a redirect, and a version missing
on either side must each fail.

```bash
node --test check-versions.test.mjs
```

```text output
1..8
# tests 8
# suites 0
# pass 8
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 77.240672
```

Then open the built 1.x page. Its banner says it is no longer actively maintained and links to
2.x, as the record in the next section shows.

## When it goes wrong

Search sends readers to the v1 guide first. Every version is open to crawlers and listed in the
sitemap, so nothing tells a search engine which copy of the quickstart to prefer. `record.sh` built the site twice, as
committed and with `noIndex` removed:

```bash
node show.mjs docusaurus
```

```text output
as committed:
  sitemap: https://docs.example.com/ https://docs.example.com/docs/quickstart
  /docs/quickstart: robots absent, docsearch:version current
    banner: none
  /docs/1.x/quickstart: robots noindex, nofollow, docsearch:version 1.x
    banner: This is documentation for Pets API guides 1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version (2.x).
control, noIndex removed:
  sitemap: https://docs.example.com/ https://docs.example.com/docs/1.x/quickstart https://docs.example.com/docs/quickstart
  /docs/quickstart: robots absent, docsearch:version current
    banner: none
  /docs/1.x/quickstart: robots absent, docsearch:version 1.x
    banner: This is documentation for Pets API guides 1.x , which is no longer actively maintained. For up-to-date documentation, see the latest version (2.x).
```

`noIndex` adds the robots tag and drops the page from the sitemap.[^1] For your own search box,
Algolia [contextual search](https://docusaurus.io/docs/search#contextual-search) keeps results to
the version a reader is on, and the build tags each page with `docsearch:version`, so leave
both switched on.

The `unmaintained` banner says "no longer actively maintained" even on a version you still
patch. The theme writes that sentence for every such version, so match the status in the
manifest to it.

A retired version answers 404. Deleting `versioned_docs/version-0.x` removes the pages and their
inbound links with them. Keep a redirect for each retired version in `static/_redirects`, as the
manifest's `redirect` field requires.

## When not to do this

Do not version guides for an API that ships one version. A version picker with one entry
is a control that does nothing, and every snapshot is a copy to keep.

Do not snapshot per minor release. Version the guides at the boundary where a reader's code has
to change, which is the major version the policy names, and fix minor differences in place.

Skip Docusaurus versioning when majors differ more than they share. A branch per version then
costs less than a snapshot that is mostly rewritten. mike suits an MkDocs site already on
`gh-pages`, where it ran three commits for two versions and set `canonical_version` to point
both at `latest`.[^2] Mintlify suits a team that wants the build hosted, and its
[search help page](https://www.mintlify.com/docs/help-center/site-search-returns-no-results) says
`hidden: true` on a version takes its pages out of the search index.

## Related how-tos

- [Turn a breaking release changelog into a migration guide](/howto/changelog-to-a-migration-guide)

- [Move guides to a new docs toolchain without breaking URLs](/howto/migrate-a-guides-site-without-breaking-urls)

- [Release reference docs and the SDK from one tag](/howto/release-reference-docs-with-the-sdk)

- [Run a try-it console without leaking credentials](/howto/run-a-try-it-console-safely)

- [Audit reference docs for keyboard and screen reader access](/howto/audit-reference-docs-for-accessibility)

## Last verified

Verified 2026-11-30 against Node 22.23.5. Every output block is what the command preceding it
printed in the page's code directory. The Docusaurus, mike, and branch records come from
`record.sh`, which built the site with `@docusaurus/core` 3.10.2, deployed it with mike 2.2.0,
and cherry-picked with git 2.43.0. Mintlify was not run, and its row is read from its
documentation.

[^1]: The robots tag Docusaurus writes is `noindex, nofollow`. Google's
[robots meta tag reference](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag)
defines `noindex` as keeping the page out of search results and `nofollow` as not following its
links, which includes the banner link that points readers at 2.x.

[^2]: The mike [README](https://github.com/jimporter/mike) describes `canonical_version` as the
version that tells search engines what pages to prefer. Left at `null`, it falls back to the
version named in `mike deploy`, which makes each frozen build the canonical copy of itself.