Skip to content
Advertisement

Is there a way to have two docs in Docusaurus 2?

As I know, Docusaurus supports customized pages, but is there a way to have two docs in one Docusaurus project?

The original Navbar items have:

  • Docs
  • Blog

I want to have something like this:

  • Docs 1
  • Docs 2
  • Blog

I know I can make many subfolders just in one doc, but for some reason, I want a two Docs structure, which gives me a cleaner way to access docs.

If Docusaurus cannot offer this feature currently, I want to ask is there other documentation frameworks offer this feature?

Advertisement

Answer

You need to use the plugin-content-docs.

First, create the other docs folder, like docs, docs-api, docs-system.

(1) In your docusaurus.config.js file, configure your “default” docs:

JavaScript

(2) Now, the magic!: in the same file, configure your other documents:

JavaScript

(3) Now you probably want these documents in your NavBar, right? So add then!

JavaScript

IMPORTANT

Sometimes you will modify your docusaurus.config.js and will not “work”, so close the docusaurus service (just Ctrl+C in your terminal/power shell) and restart it — I could have saved a few hours if a had known this before.

If you don’t have the plugin-content-docs plugin, just install it:

npm install –save @docusaurus/plugin-content-docs


ROADMAP

I had a hard time figuring this out. What I did was download the whole docusaurus project, get the website part, trim everything that I did not need and this is what I got.


REFERENCES (Update 2022/03/02)

https://docusaurus.io/docs/docs-multi-instance

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement