A freshly initialized Docusaurus site has the following structure:
1 | example.com/ -> generated from `src/pages/index.js` |
All docs will be served under the subroute docs/
. But what if your site only has docs, or you want to prioritize your docs by putting them at the root?
Assume that you have the following in your configuration (docusaurus.config.js):
1 | module.exports = { |
To enter docs-only mode, change it to like this:
1 | module.exports = { |
Note that you don’t necessarily have to give up on using the blog or other plugins; all that routeBasePath: '/'
does is that instead of serving the docs through https://example.com/docs/some-doc
, they are now at the site root: https://example.com/some-doc
. The blog, if enabled, can still be accessed through the blog/
subroute.
Don’t forget to put some page at the root (https://example.com/
) through adding the front matter(docs/intro.md):
1 | --- |
Note: If you added slug: /
to a doc to make it the homepage, you should delete the existing homepage at ./src/pages/index.js
, or else there will be two files mapping to the same route!
Now, the site’s structure will be like the following:
1 | example.com/ -> generated from `docs/intro.md` |