I would like to exclude certain files from the build based on the value of a variable defined in the front-matter of the files for a given environment.
For example, if the environment is staging
, and the file front-matter contains a variable test
with value true
(test: true
), I want to entirely exclude this file from the staging
build only.
Is this possible?
I know about the exclude
variable in the _config.yml
and understand how it works, but I have many files in different folders and it’s a lot of effort to manually list them in the exclude
variable and keep the list updated as new files are added. I need a simpler approach such as the one I described.
Thanks.