Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acrobit/docusaurus-plugin-auto-sidebars
A docusaurus plugin that generates the sidebar items automatically by filesystem structure
https://github.com/acrobit/docusaurus-plugin-auto-sidebars
docusaurus docusaurus2 generator markdown plugin sidebar sidebars static-site static-site-generator
Last synced: 3 months ago
JSON representation
A docusaurus plugin that generates the sidebar items automatically by filesystem structure
- Host: GitHub
- URL: https://github.com/acrobit/docusaurus-plugin-auto-sidebars
- Owner: acrobit
- Created: 2020-04-12T18:13:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:19:59.000Z (almost 2 years ago)
- Last Synced: 2024-05-22T15:33:13.362Z (6 months ago)
- Topics: docusaurus, docusaurus2, generator, markdown, plugin, sidebar, sidebars, static-site, static-site-generator
- Language: JavaScript
- Homepage:
- Size: 479 KB
- Stars: 21
- Watchers: 4
- Forks: 5
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
```bash
yarn add docusaurus-plugin-auto-sidebars
```or
```bash
npm install docusaurus-plugin-auto-sidebars --save
```## Usage
1. Create an empty `sidebars.auto.js` in the root of the project2. Add this plugin to the `plugins` array in `docusaurus.config.js` :
```js
module.exports = {
// ...
plugins: [
'docusaurus-plugin-auto-sidebars'
],
}
```
Or, if you want to specify a custom `docs` folder:```js
module.exports = {
// ...
plugins: [
['docusaurus-plugin-auto-sidebars', {
docs:'mydocs'
}]
],
}
```
##### How to change the title of the folders?Just add a `sidebars.yaml` in your `docs` folder:
```yaml
- folder1:
- Parent Folder One # First element is the title of parent, next elements are sub directories
- subfolder1: Sub Folder One
- subfolder2: Sub Folder Two
- subfolder3: false # Hide it!
- folder2:
- Parent Folder Two # First element is the title
- subfolder1: Sub Folder One
- subfolder2: Sub Folder Two```
##### How to change the order of the files and the folders?
**Method 1**: By adding a number to the beggining of files and folders
```shell
1.fileX.md
2.fileY.md
3.fileX.md
```
Note : You can also use **negative numbers** to display them in reverse order : `-1. fileX.md`**Method 2**: Define them in the `sidebars.yaml` file
```yaml
- folder1:
- Parent Folder One: 1 # the order number beside the title
- subfolder1: Sub Folder One
- subfolder2: Sub Folder Two
- folder2:
- Parent Folder Two: 2 # the order number beside the title
- subfolder1: Sub Folder One
- subfolder2: Sub Folder Two```