Versions
A site needs versioned documentation when readers run different releases of your product at the same time and those releases differ in ways a reader acts on: commands, configuration keys, defaults. If most readers can move to the latest release, or old releases differ only in fixed bugs, keep one site and mark the exceptions in the text; a single site is easier to maintain and to search.
OINK v1.8.0 connects independently built sites with a version menu. The upcoming v1.9 also supports publishing several versions in one Hugo build. Choose a native build when releases share source files and readers need to switch versions on the page they are reading.
Publish several versions in one build
The key under versions supplies both the menu label and the URL prefix of an archived edition. Use v4.1 for a manual that covers the whole minor series. Installation commands can still specify an exact tag such as v4.1.2. When a download has no explicit version or tag, the edition v4.1 gives both ${version} and ${tag} the value v4.1. Use manual-${tag}.zip for an asset named manual-v4.1.zip.
The following configuration publishes two manuals. Put shared English and Chinese pages in manual/v4/docs/, for example install.md and install.zh.md. Put files introduced or changed in v4.2 at the same paths beneath manual/v4.2/. Hugo picks the first matching mount. Keep the blog in content/blog/ so only the default version publishes it, and set version_shared: true in content/blog/_index.md so links from older manuals know that /blog/ is intentionally shared across releases.
Write [Install](/docs/install/) in both languages. On the older Chinese site it opens /v4.1/zh/docs/install/. An explicit language such as /en/docs/install/ keeps the version. An explicit version such as /v4.2/docs/install/ keeps the language. You can specify both prefixes in either order. With separate domains for each language, a language switch points to the corresponding host.
Because content/blog/_index.md sets version_shared: true, a link to /blog/ in the older manual opens the default version’s blog in the same language; an unshared manual chapter added in v4.2 and missing from v4.1 is reported as an unresolved site link instead of silently opening v4.2 commands. An explicit version binds the link to that release. If the target is missing, the build names the content file that holds the link and keeps the authored address. Set params.links.missing to error for a failing build or ignore for silent output. With params.ui.version_link: true, the page-action menu and command palette add Copy version link (/v4.2/docs/install/) on versioned manual pages while omitting it on version_shared sections. When defaultContentVersionInSubdir is false, back the current release’s /v4.2/docs/* paths with temporary 302 redirects (scoped to manual paths, never /*, while frozen patch aliases such as /v4.1.0/* -> /v4.1/:splat use 301) so tickets pasted today resolve to /docs/* now and directly to /v4.2/docs/* once v4.3 becomes the default. A link to an alias keeps the alias address in the reader’s version, and that version’s redirect leads on. With disableAliases: true, configure the redirect on your host. A relative URL such as ../install/, a Print address such as /_print/book/ and a Markdown output such as /docs/install/index.md also stay in that version. Use relative .md paths for source pages. To link a Markdown download in static/, start at the site root, for example /downloads/guide.md. The published-output check below verifies that file exists. A directory served from static/ still reports a missing page. Markdown exports use the same destinations and preserve local fragments and code examples.
The navbar, footer and command palette switch to the matching page, or to the target version’s home when that page is absent. With params.ui.compare: true, pressing V opens Duo View side by side with another native version of the same page (including linked version and language menus). Each version searches its own pages. With version_home: /docs, opening an older home takes the reader to its local documentation root. Omit the setting to keep the Landing page. Older pages show a link to the latest version and consolidate their <link rel="canonical"> to the matching page in the default version (falling back to the newest intermediate version or self when a page was removed in newer releases, and staying out of the older version’s sitemap.xml and hreflang links whenever canonicalized forward). Mark a release or a section with version_status: archived to show the archive notice, and add noindex: true to its cascade if you want search engines to drop that release completely instead of consolidating signals. When a project also defines Spaces (roles), params.versions entries accept a roles allowlist.
You can append a separately hosted archive under params.versions. If its URL is /manual/classic/, a link to /manual/classic/install/ opens the archive even when the current manual has an installation page at the same content path. Use a relative .md source link to reach the local page in the same directory. A full URL such as https://docs.example.org/status/ always opens the address you specify. The version_menu_pagelinks setting controls the archive’s menu entry. To omit taxonomy pages from an old release, add a cascade entry with target: {kind: '{taxonomy,term}', sites: {matrix: {versions: ['v3.*']}}} and build: {render: never, list: never}.
Add independently built versions to the menu
List the independently hosted versions under params.versions. When the list is not empty, a
branch icon in the navbar opens the version menu, and an icon-only menu in the
footer’s bottom bar opens upward with the same entries.
An entry shows its version, or its name when it has one. The entry whose
version equals params.version, or whose url equals the site’s baseURL
(a trailing slash aside), is marked as the current one.
An entry without a url is a gray item that cannot be clicked, which makes a
group heading, and name: '---' draws a divider (a url on a divider warns).
name accepts inline Markdown:
The same list feeds “switch version” in the command palette, so the menu and the palette always agree.
The trade-off in page-for-page links
By default an external archive entry opens the target version’s home page.
version_menu_pagelinks: true appends the current page’s path to the target
URL instead, so switching version keeps the reader on the same document. The
risk is a 404: documentation structure changes between versions, and a page
added in v2.1 does not exist in v1.9. This site leaves the option off.
When most versions share a structure and one does not, turn the option on and opt that one entry out:
pagelinks: false is the only per-entry setting; an entry cannot turn page
links on when the site-wide option is off. Decide by how stable the structure
is rather than by how far apart the version numbers are: one extra click from
a version’s home page costs the reader less than a 404.
The archive banner
When you stop maintaining an independently built version, mark its site as a snapshot so that readers arriving from a search engine know to look for something newer:
With archived_version: true, every page of the site, blog and landing pages
included, opens with a banner saying that version v1.9 is no longer actively
maintained and that this is an archived snapshot, with a link to
url_latest_version. Add params.ui.noindex: true when an independently built
archive should also stay out of search engines (noindex, follow and an empty
sitemap.xml). The text comes in the site’s language, so you write none
of it. The version number in the banner is params.version; without it the
build warns and leaves the banner out, so set both. A url_latest_version
that fails the theme’s URL check warns, and the banner appears without the
link.
params.version versus params.versions
An independently built site uses these two settings. A native matrix gets the current version from Hugo for its menu, banner and download records.
params.versionsis a list of sites: the versions in the menu and where each one lives.params.versionnames the version this build is. It marks the current menu entry, supplies the banner’s version number, and is the fallback when adata/download/*.yamlfile omitsversion(see Releases and downloads).
params.version is a label for readers and need not be a Git ref. When
content needs a release tag that resolves, such as the version in an install
command, declare a separate parameter for it instead of reusing
params.version. Both keys are defined in
Configuration.
Deploy independently built versions
baseURL: https://v1-9.docs.example.com/
Versions are fully independent; each needs its own DNS record and certificate.
baseURL: https://docs.example.com/v1.9/
One domain collects all search ranking; the host must route each path to a different build.
Build each version on its own: check out its branch or tag, build with that
version’s hugo.yml, and publish to its address. Because the menu is part of
each build, adding a version means updating params.versions on every branch
you still publish and rebuilding those sites; an old site that is not rebuilt
keeps its old menu. Archived sites carry the same list plus
archived_version: true.
baseURL must include the path segmentOtherwise the search index, page actions and asset links all point at the domain root. The page looks correct, but search returns nothing, which makes this the most common subpath failure. See Deploy for the rest of the host setup.
Verify
From the site root, scan the published HTML and the page actions in its command manifest. Pass your deployment URL, including any path prefix. With no --version, the scanner includes the default edition and recognizes other editions by their Hugo site outputs. Repeat the option to select particular editions, or use --version editor/v4.1 to select one role. For separate language domains, run it once per publish directory and URL. It checks edition boundaries, local page and machine-output links, and the published files behind shared Markdown, HTML and XML links. It also checks the generated entries in llms.txt. Within each llms-full.txt, it compares records with their page Markdown up to the first HTML-only source. An explicitly host-qualified service or a separately deployed archive can live outside the build.
For independently built sites, check the menu after a production build. Replace
public/docs/getting-started/index.html with a documentation page your site
actually generates, including the language prefix if it has one.
-
Confirm that the version menu reached the page:
A single-version build shows this menu when
params.versionscontains entries. -
Check that the current version is marked:
No result means that no entry’s
versionequalsparams.versionand no entry’surlequalsbaseURL. -
Follow each menu link. With
version_menu_pagelinkson, switch from a page that an older version lacks and check that the reader lands somewhere acceptable. -
On an archived site, open any page and check that the banner is at the top, in the site’s language, with a working link to the current version.
-
Press ⌘/Ctrl + K and check that “switch version” lists the same versions as the menu.
Related
- Navigation and menus — where the version menu sits in the navbar and footer
- Command palette — “switch version” in the palette
- Deploy —
baseURL, subpaths and multi-target publishing - Releases and downloads — download data falling back to
params.version - Configuration — full definitions of
version/versions/archived_version