Search code examples
docusaurus

Is there a way to use Docusaurus just for the /docs directory?


I have an existing website, and just want to use docusaurus to manage the /docs directory (e.g. published as a static site into there). When I follow all the documentation it creates both the docs directory and separate website directory, how can I just have it render /docs when testing locally and only publish that sub-directory when doing a build of the static site?


Solution

  • Found the answer in the docs:

    To enter docs-only mode, change [your configuration] to like this:

    docusaurus.config.js

    module.exports = {
      // ...
      presets: [
        '@docusaurus/preset-classic',
        {
          docs: {
            routeBasePath: '/', // Serve the docs at the site's root
            /* other docs plugin options */
          },
          blog: false, // Optional: disable the blog plugin
          // ...
        },
      ],
    };