Ignore certain files and directory in Hugo


I have a README.md file and a dummy_files directory under themes/main/layouts/partials/some_dir. I want to tell Hugo not to parse the readme and the files in that dummy_files directory, but I can’t seem to achieve that.

I tried to use the following:

ignoreFiles = [ "themes/main/layouts/partials/some_dir/README.md", "themes/main/layouts/partials/some_dir/dummy_files/*"]

but also tried the following:

source = 'themes/main/layouts'
target = 'layouts'
excludeFiles = ['partials/some_dir/README.md', 'partials/some_dir/dummy_files/**']

but nothing seems to work. It seems that Hugo still parses these files.

I would recommend you look at

And especially the include/exclude files options; it’s implemented as close to the file system as you get and is much more powerful and flexible than the ignoreFiles option.

Thank you for responding. I tried this see my example above but it does not work. Hugo server still parses the files.

It works if you set it up correctly. I use this all the time. But I don’t see your site source, so it’s a little hard to tell. I’m seeing the word “theme” here, so I’m guessing:

You need to include your theme via:

The old theme option still works, but it does not provide you with the extended mount config needed in the above.