Rspress's default theme supports multi-version document management. Next, we will introduce how to access multi-version documents.
multiVersion
configConfigure the version list and default version through multiVersion
, for example:
Here, default
is the default version, and versions
is the version list.
According to the version list you configured, add multi-version documents under the docs
directory, for example:
In Rspress's conventional routing, for the default version, the version path prefix will be automatically omitted. For example, v1/README.md
will be rendered as the /README
route, while v2/README.md
will be rendered as the /v2/README
route.
For links in the document, you do not need to manually add the version prefix. Rspress will automatically add the corresponding version prefix according to the version of the current document. For example, the link /guide/README
in v2/README.md
will be rendered as /v2/guide/README
.
In components, you can get the current version through useVersion
, for example:
You can configure search.versioned
to only search through the current version's documents.