Skip to content

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

@polynook

Description

@polynook

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    In BETAThe current task is available for testing in the BETA version.ReleasedThe task has been releasedenhancementNew feature or requestv10.5.0Project: v10.5.0

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions