docusaurus/website/docs/sidebar.md
Wei Gao 95fde5f827 docs(v2): refactor docs for better outline and welcoming PRs (#1641)
* docs(v2): refactor docs for better outline and welcoming PRs

* docs(v2): update docs
2019-07-07 23:14:49 -07:00

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.