ignoreFiles in several folders with same name

Hello everyone,

I have a small problem with a feature that has stopped working in the most modern versions of hugo.

Within the content I have files that I want to ignore. All these files that I want to ignore are in folders called “ignored” in different bundles of the content folder. Until version 0.55.6 it worked with putting ignoreFiles: “ignored” in the configuration file.

In versions higher than 0.55.6 this no longer works. I don’t know if there is any way to do something similar again.

It is very useful, for example, to save all the images that I do not use and I do not want to render but I want to save for the future, in the same bundle.

Thank you.

ignoreFiles is a list but above you posted this:

ignoreFiles: "ignored"

I wonder if this would work for you:

ignoreFiles:
  - ignored

Note that in YAML you do not need to surround the string ignored with quotes, but it should not be a problem if you do.

I use the following and it seems to be working in Hugo v0.58.2/extended

ignoreFiles:  
  - UNPUBLISHED
  - BACKUP

I think items in an ignoreFiles list are case sensitive so I tend to use upper case characters in file and directory names that I want Hugo to ignore.

I hope this helps!

2 Likes

If you work with config.toml - use

ignoreFiles = ["ignored"]
This is an array / list!

No luck, it still does not work in modern versions. (i am using yaml in the config file)

Just in case I leave a small diagram of how I have organized the files

content
- bundle1
- - index.md
- - file.jpg
- - ignored
- - - fileiwanttoignore.jpg
- - - fileiwanttoignore2.jpg
- bundle2
- - index.md
- - file.jpg
- - ignored
- - - fileiwanttoignore.jpg
- - - fileiwanttoignore2.jpg

It is not a big problem so for now I will try to manage them in another way. Thank you.

1st You should create an issue on github

2nd try - Files in the asset directories are ignored until referenced
move content/bundle*/ignored to assets/bundle*

I just tested your structure and your names on my system and the ignored directory was ignored. Here are some questions that might help us figure out what’s going on:

  • What exactly do you have in your config file related to ignoreFiles?
  • When you run hugo config |more, what is displayed that is related to ignoreFiles?
  • What is displayed when you run hugo version?
  • When you say “this no longer works”, what do you mean? Do you mean that the ignored directories are being output to the destination directory when you build your site with hugo?
  • What flags do you use when you build with hugo, e.g., hugo --minify etc?
  • Do you reference these ignored files in any of your layouts or shortcodes. If so, it’s possible that in hugo referencing a file takes precedent over ignoring a file.

Thanks to the suggestions of _nm I have been able to solve the problem.

The two things that I have changed are:

ignoreFiles: “ignored”

to

ignoreFiles:
- ignored

and change the template, because I was referencing (not on purpose) some images in the ignored folders and the build was failing.

I am currently using version 0.58.2

The weird thing is that with version 0.55.6 and earlier versions none of this gave failures.