Docusaurus#
What Is The Docusaurus?#
- Docusaurus is a static-site generator. It builds a single-page application with fast client-side navigation, leveraging the full power of React to make your site interactive. It provides out-of-the-box documentation features but can be used to create any kind of site (personal website, product, blog, marketing landing pages, etc).
-
The interesting thing about
Docusaurus
is that it will convert markdown files into html pages by using html templates, so with this feature, we just need to focus on writing contents in markdown files, theDocusaurus
will do all the rest for us.
Installation#
NodeJs#
- Firstly, you need to install the Node.js on your computer. The version of Node.js should be 16.14 or above (which can be checked by running node -v). You can use nvm for managing multiple Node versions on a single machine installed.
- If you don't know how to install Node.js on your computer please view this page
Create Sample Docusaurus Project#
- Now, let's use the command below to create a sample Docusaurus project. This sample Docusaurus project will have name
my-blog
.
1 |
|
-
The
classic
template contains@docusaurus/preset-classic
which includes standard documentation, a blog, custom pages, and a CSS framework (with dark mode support). You can get up and running extremely quickly with the classic template and customize things later on when you have gained more familiarity with Docusaurus. -
After execute the command above successfully, you will see the log results with some guides as below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
Test Sample Docusaurus Project#
- After the creating step above you will see the Docusaurus Project with the structure as below.
my-blog
├── blog
│ ├── 2019-05-28-hola.md
│ ├── 2019-05-29-hello-world.md
│ └── 2020-05-30-welcome.md
├── docs
│ ├── doc1.md
│ ├── doc2.md
│ ├── doc3.md
│ └── mdx.md
├── src
│ ├── css
│ │ └── custom.css
│ └── pages
│ ├── styles.module.css
│ └── index.js
├── static
│ └── img
├── docusaurus.config.js
├── package.json
├── README.md
├── sidebars.js
└── yarn.lock
- Now let's use the command
npm start
to start your Docusaurus Project and you will see your Docusaurus Project will run at porthttp://localhost:3000/
as below.