The section Add a Version Dropdown in the Tutorial proposes a change to the docusaurus.config.js file that can cause the web site to crash if it is improperly made.
As described in another post, a change to the tutorial would solve one problem, BUT the fact that undoing the change made to docusaurus.config.js file DID NOT ALLOW THE WEB SITE TO RESTART might indicate an underlying software problem.
The change proposed in the tutorial is the addition of the following code to the docusaurus.config.js file:
module.exports = {
themeConfig: {
navbar: {
items: [
{
type: 'docsVersionDropdown',
},
],
},
},
};
The tutorial does not indicate where exactly the code should be inserted. For the record, it should be inserted 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 as follows after type: 'docsVersionDropdown', has been added:
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',
},
],
},
If, on the other hand, you modify the " type: 'doc' " field to type: " 'docsVersionDropdown' " at the following point in the items array:
items: [
{
type: 'docsVersionDropdown',
docId: 'intro',
in the docusaurus.config.js file, 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 persists even after you have changed " type: 'docsVersionDropdown', " back to "type: 'doc',". You have to revert the docusaurus.config.js file to a fresh copy to be able to restart the web site.
This may indicate an underlying software problem.