Enhancement: Add excludePaths option to frontmatter.content.pageFolders config entries to allow filtering out subdirectories and filepaths based on regex matches #662

Closed
opened 2026-10-05 02:59:12 +02:00 by adam · 5 comments
Owner

Is your feature request related to a problem? Please describe.

As of now, frontmatter.content.pageFolders config allows excludeSubdir which is a boolean flag. This is too restrictive to certain workflows.

For example:

We have a docs content folder defined that contains documentation pages. The /.frontmatter/docs/ directory contains handwritten doc files, but there is a subdirectory /.frontmatter/docs/api that has generated pages. These generated pages are not meant to be edited by hand, but they still appear in the CMS dashboard, slowing it down (when the number of pages is in the thousands) and need to be constantly filtered out in the dashboard.

Describe the solution you'd like
Add an excludePaths option to content definitions in frontmatter.content.pageFolders that would be a list of glob patterns and/or regex patterns to match against:

{
  "frontMatter.content.pageFolders": [
    {
      "title": "Pages",
      "path": "/.frontmatter/docs",
      "excludePaths": [
           "api",
           "_*.*" // exclude all files starting with an underscore
      ]
    },
}

excludePaths option would resolve paths relative to the path option of this config. It should support matching against both directories and filepaths for maximum flexibility, since we may not want to exclude select paths.

Supporting glob patterns is nice for ease of use and regex patterns is nice for more complex cases and flexibility.

Describe alternatives you've considered
Haven't come up with any viable alternatives.

**Is your feature request related to a problem? Please describe.** As of now, `frontmatter.content.pageFolders` config allows `excludeSubdir` which is a boolean flag. This is too restrictive to certain workflows. For example: We have a `docs` content folder defined that contains documentation pages. The `/.frontmatter/docs/` directory contains handwritten doc files, but there is a subdirectory `/.frontmatter/docs/api` that has generated pages. These generated pages are not meant to be edited by hand, but they still appear in the CMS dashboard, slowing it down (when the number of pages is in the thousands) and need to be constantly filtered out in the dashboard. **Describe the solution you'd like** Add an `excludePaths` option to content definitions in `frontmatter.content.pageFolders` that would be a list of glob patterns and/or regex patterns to match against: ```json { "frontMatter.content.pageFolders": [ { "title": "Pages", "path": "/.frontmatter/docs", "excludePaths": [ "api", "_*.*" // exclude all files starting with an underscore ] }, } ``` `excludePaths` option would resolve paths relative to the `path` option of this config. It should support matching against both directories and filepaths for maximum flexibility, since we may not want to exclude select paths. Supporting glob patterns is nice for ease of use and regex patterns is nice for more complex cases and flexibility. **Describe alternatives you've considered** Haven't come up with any viable alternatives. <!-- github-sync-id:2465249744 -->
adam closed this issue 2026-10-05 02:59:12 +02:00
Author
Owner

@polynook, thanks for the suggestion. It is available in the beta for testing. It is implemented like the example above. Let me know what you think.

@polynook, thanks for the suggestion. It is available in the beta for testing. It is implemented like the example above. Let me know what you think. <!-- github-comment-id:2399448143 -->
Author
Owner

@estruyf Thank you for working on this!

I can't seem to get it to work though. I get Property excludePaths is not allowed. when trying to define it in frontmatter.json.

Inspecting https://beta.frontmatter.codes/frontmatter.schema.json appears to be missing the excludePaths option.

Here is how I use it:

"frontMatter.content.pageFolders": [
        {
            "title": "Page",
            "contentTypes": ["Page"],
            "path": "[[workspace]]/.frontmatter/content/page",
            "previewPath": "/",
            "excludePaths": ["generated/*"]
        },
    ],

The files that should be excluded reside in [[workspace]]/.frontmatter/content/page/generated/.

I'm using Front Matter v10.5.112333718.

@estruyf Thank you for working on this! I can't seem to get it to work though. I get `Property excludePaths is not allowed.` when trying to define it in `frontmatter.json`. Inspecting https://beta.frontmatter.codes/frontmatter.schema.json appears to be missing the `excludePaths` option. Here is how I use it: ```json "frontMatter.content.pageFolders": [ { "title": "Page", "contentTypes": ["Page"], "path": "[[workspace]]/.frontmatter/content/page", "previewPath": "/", "excludePaths": ["generated/*"] }, ], ``` The files that should be excluded reside in `[[workspace]]/.frontmatter/content/page/generated/`. I'm using Front Matter `v10.5.112333718`. <!-- github-comment-id:2400310637 -->
Author
Owner

I can't seem to get it to work though. I get Property excludePaths is not allowed. When trying to define it in frontmatter.json.

You can ignore this, as the schema only updates when the documentation site has updates. As it needs to be verified, I haven't done this yet, so you get that. Once it's all working, I update the docs and the schema as well.


I added a small fix for the Windows file system support. I believe this should fix your issue.

> I can't seem to get it to work though. I get Property excludePaths is not allowed. When trying to define it in frontmatter.json. You can ignore this, as the schema only updates when the documentation site has updates. As it needs to be verified, I haven't done this yet, so you get that. Once it's all working, I update the docs and the schema as well. --- I added a small fix for the Windows file system support. I believe this should fix your issue. <!-- github-comment-id:2400488043 -->
Author
Owner

I'm running on WSL and the issue for me was using an incorrect glob pattern ("generated/*" instead of "generated/**") since the content is nested.

You can ignore this, as the schema only updates when the documentation site has updates. As it needs to be verified, I haven't done this yet, so you get that. Once it's all working, I update the docs and the schema as well.

Gotcha. Not sure if you've updated the docs already, but I just wanted to let you know that the schema says excludePaths is boolean:

"excludePaths": {
  "type": "boolean",
  "default": false,
  "description": "Exclude paths (e.g. api, _*.*)"
},

should be

"excludePaths": {
  "type": "array",
  "default": [],
  "description": "Exclude paths (e.g. api, _*.*)"
},

Please ignore if this is related to the documentation site not having been updated yet.

Everything else works great, thank you!

I'm running on WSL and the issue for me was using an incorrect glob pattern (`"generated/*"` instead of `"generated/**"`) since the content is nested. > You can ignore this, as the schema only updates when the documentation site has updates. As it needs to be verified, I haven't done this yet, so you get that. Once it's all working, I update the docs and the schema as well. Gotcha. Not sure if you've updated the docs already, but I just wanted to let you know that the schema says `excludePaths` is boolean: ```json "excludePaths": { "type": "boolean", "default": false, "description": "Exclude paths (e.g. api, _*.*)" }, ``` should be ```json "excludePaths": { "type": "array", "default": [], "description": "Exclude paths (e.g. api, _*.*)" }, ``` Please ignore if this is related to the documentation site not having been updated yet. Everything else works great, thank you! <!-- github-comment-id:2402733295 -->
Author
Owner

That type was indeed incorrect, updated it.

That type was indeed incorrect, updated it. <!-- github-comment-id:2402739521 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#662