Version Manage
Docusaurus can manage multiple versions of documents.
Create Version
Release version 1.0 of the project
- npm
- Yarn
- pnpm
# 将 `docs` 文件夹复制到 `versioned_docs/version-1.0` 并创建 `versions.json`
npm run docusaurus docs:version 1.0
# 将 `docs` 文件夹复制到 `versioned_docs/version-1.0` 并创建 `versions.json`
yarn docusaurus docs:version 1.0
# 将 `docs` 文件夹复制到 `versioned_docs/version-1.0` 并创建 `versions.json`
pnpm run docusaurus docs:version 1.0
Your docs now has 2 versions.:
1.0
:http://localhost:3000/docs/
For version 1.0 docscurrent
:http://localhost:3000/docs/next/
For upcoming unreleased docs
Add version drop down
To kua version seamless navigation, add a version down to the list
Modify docusaurus.config.js
file:
docusaurus.config.js
export default {
themeConfig: {
navbar: {
items: [
{
type: 'docsVersionDropdown',
},
],
},
},
};
docs version drop-down list appears in the navigation bar:
Update existing version
You can edit the versioned docs in their respective folders:
- 1.0:
versioned_docs/version-1.0/hello.md
updateshttp://localhost:3000/docs/hello
- current version:
docs/hello.md
updateshttp://localhost:3000/docs/next/hello