Versioning
Keep the documentation of older releases online, next to the current one.
Sur cette page
Declare your versions with the versions option. Each key is both a content directory and a URL prefix, except root, which is the current version served without a prefix.
zenith({
title: 'My Docs',
versions: {
root: { label: 'v2', badge: 'Latest' },
v1: { label: 'v1' },
},
});| Field | Purpose |
|---|---|
label |
Name shown in the version switcher |
badge |
Small tag next to the label, such as Latest |
The current version lives at the root of the docs directory, and each older version in its own directory:
src/content/docs
v1
installation.mdx is served at /installation/, and v1/installation.mdx at /v1/installation/.
Before starting work on a new major version, archive the current one: copy its pages into a directory named after it, such as v2/, leaving out the directories of older versions and of other languages. Add v2 to the versions option, then keep editing the root for the new version. Each version is edited independently from then on.
A version switcher appears in the header as soon as a second version is declared. It links to the same page in the other version, and falls back to that version’s home page when the page does not exist there.
Each version has its own navigation: sidebar, page order and previous and next links stay inside the version being read.
Versions and languages combine, the language first and the version second: /fr/v1/installation/. A page missing from a translation falls back to the default language of the same version, so readers never jump between versions without noticing.
llms.txt and llms-full.txt only cover the current version, so models are not fed outdated instructions. Pages of older versions keep their own .md version, for readers who link to them.