Add a Version Dropdown in Tutorial needs more explanation
closed
K
Kevin Donovan
The section Add a Version Dropdown in the Tutorial needs more explanation. It needs to be stressed that the changes to make to the docusaurus.config.js file that are described in this file should be made at a specific point in the file i.e. at the end of the items array of objects and NOT at the beginning as implied by the example.
In other words, the items array in the docusaurus.config.js file should look like this:
navbar: {
title: 'My Site',
logo: {
alt: 'My Site Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Tutorial',
},
{to: '/blog', label: 'Blog', position: 'left'},
{
label: 'GitHub',
position: 'right',
},
{
type: 'docsVersionDropdown',
},
],
},
When you modify the type: 'doc' field in the example to type: 'docsVersionDropdown' in the docusaurus.config.js field, the web site crashes with the message:
A validation error occurred.
The validation system was added recently to Docusaurus as an attempt to avoid user configuration errors.
We may have made some mistakes.
If you think your configuration is valid and should keep working, please open a bug report.
This problem persisted even after the change to docusaurus.config.js was reverted. I had to overwrite the docusaurus.config.js file with a fresh copy to be able to restart the web site.
Vitaly Bazylo
Thank you very much.
Sébastien Lorber
closed
closing as it's not really a feature request
Joshua Chen
I guess what's missing is mentioning that {type: 'docsVersionDropdown'} has to be a separate item😅 Wonder how many people would misunderstand and modify an existing one though
Update: I tried myself with a freshly installed Docusaurus site and modified type: 'doc' into type: 'docsVersionDropdown', but no error showed up. In fact any unknown keys are allowed in the navbar items, so wonder how in your case there's an error... Maybe you can submit a bug report including reproducible steps?