Elian Ibaj
Elian Ibaj

Reputation: 438

Is there a way to exclude paths within docs directory in docusaurus?

I want to exclude a subfolder from the docs/ directory from generating doc pages. customDocsPath is a related option but it's a string. Is there by any chance some undocumented option that accepts something like a glob pattern?

Upvotes: 2

Views: 4677

Answers (4)

Maxim Suslov
Maxim Suslov

Reputation: 5475

Also you can start your folder or file with _.

According to the documentation:

All files prefixed with an underscore (_) under the docs directory are treated as "partial" pages and will be ignored by default.

Most probably you need to include such folder into .gitignore.

Upvotes: 0

Alysson_Teixeira
Alysson_Teixeira

Reputation: 1

You just need to go to your ducusaurus.config.file and add and set on presets/docs the routeBasePath: '/'

  presets: [
     [
          'classic',
          /** @type {import('@docusaurus/preset-classic').Options} */
          ({
            docs: {
              routeBasePath: '/',

more info: https://docusaurus.io/docs/advanced/routing

Upvotes: 0

Yangshun Tay
Yangshun Tay

Reputation: 53169

To formally answer your question, no there isn't an option to do so in Docusaurus V1.

It's unlikely that we will add this into V1 but we would be happy to support that functionality in V2 and add a draft option in the front matter so that it would show up during development but not the production build.

Upvotes: 0

1natsu
1natsu

Reputation: 21

I was able to exclude it by specifying the configuration of the @docusaurus/preset-classic (@docusaurus/plugin-content-docs) plugin.

https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs

presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          exclude: ['**/any/dir/**'],
        },
      },
    ],
  ],

I tested it with v2beta.9.

Upvotes: 2

Related Questions