mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-11-03 09:02:19 +01:00
Enhancement: Add excludePaths option to frontmatter.content.pageFolders config entries to allow filtering out subdirectories and filepaths based on regex matches
#662
Reference in new issue
Block a user
Is your feature request related to a problem? Please describe.
As of now,
frontmatter.content.pageFoldersconfig allowsexcludeSubdirwhich is a boolean flag. This is too restrictive to certain workflows.For example:
We have a
docscontent folder defined that contains documentation pages. The/.frontmatter/docs/directory contains handwritten doc files, but there is a subdirectory/.frontmatter/docs/apithat 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
excludePathsoption to content definitions infrontmatter.content.pageFoldersthat would be a list of glob patterns and/or regex patterns to match against:excludePathsoption would resolve paths relative to thepathoption 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.
@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.
@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 infrontmatter.json.Inspecting https://beta.frontmatter.codes/frontmatter.schema.json appears to be missing the
excludePathsoption.Here is how I use it:
The files that should be excluded reside in
[[workspace]]/.frontmatter/content/page/generated/.I'm using Front Matter
v10.5.112333718.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'm running on WSL and the issue for me was using an incorrect glob pattern (
"generated/*"instead of"generated/**") since the content is nested.Gotcha. Not sure if you've updated the docs already, but I just wanted to let you know that the schema says
excludePathsis boolean:should be
Please ignore if this is related to the documentation site not having been updated yet.
Everything else works great, thank you!
That type was indeed incorrect, updated it.