You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read the console error message carefully (if applicable).
Description
I'm trying to use the "Multiple Sidebars" feature since I have two categories in my documentation.
The documentation doesn't mention anything about this feature not working properly with auto-generated sidebars: https://docusaurus.io/docs/sidebar/multiple-sidebars
When multiple autogenerated sidebars are defined, it should be default behaviour that the directories of the new sidebars should be excluded from the main first sidebar generated from the docs directory.
It could be argued that the same behaviour could be achieved with an exclude option as discussed in #5689 (comment) but the way the documentation is defined, the impression is that multiple sidebars will be exclusive by default. If not, then it should be documented that explicitly defining the structure of docs is necessary to omit certain directories generated as a separate sidebar as done in Docusaurus website as well.
This does generate a new link on the header with "API" label and a sidebar as expected. The problem is that the same sidebar still appears nested inside of the main "Docs" sidebar.
Expected behavior
The api directory should get excluded from the main Docs sidebar as there's a separate sidebar defined for it.
Actual behavior
The api directory is both generated as a separate sidebar and appears nested inside of the Docs sidebar.
Environment name and version (e.g. Chrome 89, Node.js 16.4): Node v20.15.0, pnpm 9.10.0
Operating system and version (e.g. Ubuntu 20.04.2 LTS): MacOS 14.6.1
Self-service
I'd be willing to fix this bug myself.
The text was updated successfully, but these errors were encountered:
cseas
added
bug
An error in the Docusaurus core causing instability or issues with its execution
status: needs triage
This issue has not been triaged by maintainers
labels
Sep 13, 2024
Docusaurus lets you assemble "autogenerated sidebar slices" in various ways and doesn't do any filtering magic. If you add a sidebar slice to one sidebar, it doesn't make it disappear from another sidebar. You can add the same sidebar slice to 2 sidebars and expect the items to appear in both places.
If you want mutually exclusive autogenerated sidebars, then you'd rather create a docs/tutorial and docs/api folder. If you consider . to generate your tutorial sidebar, there's no reason to put the api folder there because you don't want to appear in your tutorial sidebar. You can solve this problem by using a dedicated folder for each sidebar, instead of having one sidebar inside another.
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I'm trying to use the "Multiple Sidebars" feature since I have two categories in my documentation.
The documentation doesn't mention anything about this feature not working properly with auto-generated sidebars:
https://docusaurus.io/docs/sidebar/multiple-sidebars
When multiple autogenerated sidebars are defined, it should be default behaviour that the directories of the new sidebars should be excluded from the main first sidebar generated from the
docs
directory.It could be argued that the same behaviour could be achieved with an
exclude
option as discussed in #5689 (comment) but the way the documentation is defined, the impression is that multiple sidebars will be exclusive by default. If not, then it should be documented that explicitly defining the structure ofdocs
is necessary to omit certain directories generated as a separate sidebar as done in Docusaurus website as well.Reproducible demo
https://codesandbox.io/p/sandbox/young-wood-5k56n7
Steps to reproduce
Define a new sidebar:
And then in docusaurus.config.ts, add the following to navbar.items:
This does generate a new link on the header with "API" label and a sidebar as expected. The problem is that the same sidebar still appears nested inside of the main "Docs" sidebar.
Expected behavior
The
api
directory should get excluded from the main Docs sidebar as there's a separate sidebar defined for it.Actual behavior
The api directory is both generated as a separate sidebar and appears nested inside of the Docs sidebar.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: