Hiding parts of docs in autogenerated sidebar
planned
R
Rohith ND
You can remove default category page by remove this json in your _category_.json.
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important Docusaurus concepts."
}
Lukas Eiter
add a new class to your css:
.hidden {
display: none !important;
}
Then add this to the top section of your md file:
sidebar_class_name: hidden
Or if you want to hide a whole category add this to the _category_.yml file:
sidebar_class_name: hidden
Mike Howes
Lukas Eiter: Nice work!!! Thanks!
Andrew Agostini
Lukas Eiter: Worked like a charm!!
Alireza Jamshidi
Lukas Eiter: Nice trick 👌
Srinidhi Narendran
Lukas Eiter: Heyy!!! this works crazy well and i can also link to another page. so i can still make use of this page while not having it on the sidebar... Thanks a lot for this. However just one thing, for the _category_.json file use: "className": "hidden" and for the _category_.yml file use: className: hidden. I got the metadata headings from this page: https://docusaurus.io/docs/sidebar/autogenerated
Mike Howes
This would be particularly useful. Would like to publish the content, but only link to it from the footer, rather than have it display in the sidebar.
Nathan Kelly
I was able to do this simply by adding a "." to the beginning of my folder or file names, eg: ./docs/guides/ can be hidden by renaming to ./docs/.guides/. or you can hide a single page by doing ./docs/guides/.testing.md
Hope this helps.
Sébastien Lorber
planned
E
Erdem Alpkaya
Sébastien Lorber: Is there any progress yet? Thanks
Joshua Chen
There should be a way to prevent generating categories for directories as well. Probably "ignore: true" in _category.json_ for folders, and in front matter for individual docs
Nziie
Joshua Chen: Agreed, and for individual files it would be in the table at the top when defining the name, etc. that would be "ignore: true: or "ignore: yes". I don't know how Dousaurus renders the side bar, but it could iterate through the pages and check if "ignore" is "true" or "yes" then not 'append' it to the sidebar pages.