mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 06:50:36 +02:00
1.5 KiB
1.5 KiB
id | title |
---|---|
sidebar | Sidebar |
To generate a sidebar to your Docusaurus site, you need to define a file that exports a JS module and pass that into docusaurus-plugin-docs
directly or via the docusaurus-preset-classic
. If you are using the classic preset, you can find the sidebars.js
under the root directory already created for you, so you may edit it directly for customization.
website # root directory of your site
├── docs
│ └── greeting.md
├── docusaurus.config.js
├── sidebars.js
.
To add a doc to the sidebar, add the id
specified in the frontmatter of the doc into its category.
module.exports = {
docs: {
+ "Getting started": ["greeting"],
"Docusaurus": ["doc1"],
"First Category": ["doc2"],
"Second Category": ["doc3"],
}
};
The docs
key in the file is just the name of that particular sidebar hierarchy, and can be renamed to something else. You can have multiple sidebars for different Markdown files by adding more top-level keys to the exported object.
Subcategories
This section is a work in progress. Welcoming PRs.