Another possibility is to use ignoreFiles
in your config file, e.g., here’s part of my config.yaml
:
ignoreFiles:
- UNPUBLISHED
Note:
-
ignoreFiles
is only relevant to thecontent
directory (but it would be great if it worked everywhere, e.g., in thestatic
directory) - each string in an ignoreFiles list is a regular expression (RE) looking for a match in the path, e.g. many of my bundles include a path like
articles/bundlename/UNPUBLISHED/oldscreenshot.png
- if the RE is all lower case, it matches case insensitively (I think)
- if the RE contains an upper-case character, it matches case sensitively (I think)
If your content directory includes directories named articles1
and articles2
, you could put, e.g., articles1
in your ignoreFiles
list and see if that does the trick. You’ll need to make sure there is no path that you want published that includes the RE articles1
. You can play around with surrounding that with path delimiters, e.g. /articles1/
but you might need to escape the slashes, e.g. \/articles1\/
. I’m still learning about REs in Hugo so I’m not sure if the slash character /
has a special meaning in Hugo REs. So far I just deal with stuff that I want ignored by using upper-case (and I don’t use upper-case for anything I want published).
Let us know how you solve this problem. I want to ignore a lot of files in my Hugo site root directory and currently do some convoluted things to do that.