Have you read the Contributing Guidelines on issues?
Prerequisites
Description
When creating a Docusaurus site with versioning enabled, setting the current version's path to / freezes the dynamic docsVersionDropdown nav bar item. The website still works fine and successfully changes the displayed version, but the dropdown loses it's ability to correctly display which version is being rendered.
Reproducible demo
https://stackblitz.com/edit/github-lptjtc?file=docusaurus.config.js
Steps to reproduce
These steps have already been conducted on the playground link above
- Create some versions of the documentation site
npm run docusaurus docs:version v0.1.2
npm run docusaurus docs:version v0.2.0
- Add versions to
docusaurus.config.js, and set the current version's path to /
const config = {
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
versions: {
current: {
label: 'Current',
path: '/',
},
'v0.1.2': {
label: 'v0.1.2',
path: 'v0.1.2',
},
'v0.2.0': {
label: 'v0.2.0',
path: 'v0.2.0',
},
},
- Add the
docsVersionDropdown to the nav bar
export default {
themeConfig: {
navbar: {
items: [
{
type: 'docsVersionDropdown',
},
],
},
},
};
- Observe the dropdown menu does not dynamically display which version is being rendered
Expected behavior
Expected behavior should be that the version dropdown displays the label of the version that is being rendered on the page. This successfully happens when the path is changed to anything but /.
Actual behavior
The version dropdown stays stuck on the Current version. It will still successfully change which version of documentation is rendered on the site, but does not change the appearance of the dropdown.
Your environment
Self-service
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clearoryarn clearcommand.rm -rf node_modules yarn.lock package-lock.jsonand re-installing packages.Description
When creating a Docusaurus site with versioning enabled, setting the
currentversion'spathto/freezes the dynamicdocsVersionDropdownnav bar item. The website still works fine and successfully changes the displayed version, but the dropdown loses it's ability to correctly display which version is being rendered.Reproducible demo
https://stackblitz.com/edit/github-lptjtc?file=docusaurus.config.js
Steps to reproduce
docusaurus.config.js, and set thecurrentversion'spathto/docsVersionDropdownto the nav barExpected behavior
Expected behavior should be that the version dropdown displays the
labelof the version that is being rendered on the page. This successfully happens when thepathis changed to anything but/.Actual behavior
The version dropdown stays stuck on the Current version. It will still successfully change which version of documentation is rendered on the site, but does not change the appearance of the dropdown.
Your environment
Self-service