Skip to main content

Get Started

Start local server​

Prerequisites​

Before installation, please make sure you have the right development environment:

  • Node.js version >= 11.10.1 (you can use nvm to manage node.js)
  • Install yarn (dependency management for node.js modules)

Installation​

Run the below command to install dependencies:

yarn # or yarn install

Start​

yarn start

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

tip

There is no need to restart server except modifying sidebars and docusaurus.config.js.

Create a new file​

Create new file.md file or new category in corresponding directory of docs

Using number prefixes​

A simple way to order an autogenerated sidebar is to prefix docs and folders by number prefixes, which also makes them appear in the file system in the same order when sorted by file name:

docs
├── 01-Intro.md
├── 02-Tutorial Easy
│ ├── 01-First Part.md
│ ├── 02-Second Part.md
│ └── 03-End.md
├── 03-Tutorial Hard
│ ├── 01-First Part.md
│ ├── 02-Second Part.md
│ ├── 03-Third Part.md
│ └── 04-End.md
└── 04-End.md

To make it easier to adopt, Docusaurus supports multiple number prefix patterns.

By default, Docusaurus will remove the number prefix from the doc id, title, label, and URL paths.

See more details: https://www.docusaurus.io/docs/sidebar/autogenerated#autogenerated-sidebar-metadata

Front matter​

open the new file you just added and add following front-matter:

---
title: Name of Second Level Item in Sidebar
---
tip

For markdown header fields, see more details about at https://docusaurus.io/docs/markdown-features#markdown-headers

Create a new category​

Step 1: create new directory​

Add new directory and files in docs.

Step 2: create new file​

Same as above.

Step 3: register entry​

Add new category in docusaurus.config.js:

docusaurus.config.js
{
themeConfig: {
navbar: {
items: [
{
label: '',
position: '',
to: '',
activeBaseRegex: '',
items: [
{
to: 'docs/xxx/01-xxx/01-xxx',
activeBasePath: 'docs/xxx/',
label: 'Xxx',
},
],
},
];
}
}
}