Ignore a directory

I want to render some content on the dev version of a site and then exclude that from the production site.

What I have tried is:

  • Placing the markdown files in a sub-folder below content ( e.g. content/docs/foo.md )
  • Using a config.toml for the production site to ignore content in that sub-folder, by using
    ignoreFiles = [ “docs” ]

But the ignoreFiles is not working and content is still rendered at public/docs/foo/

I have deleted public/ before running Hugo so I know rendered content is not a remnant from before.
I have read through docs and forum and cannot see where I am going wrong.

Any suggestions appreciated.


I got this to work with:

ignorefiles = [ "docs/.*" ]
1 Like

Thank you very much - you helped me get this working.:grinning::clap:

I tried ignorefiles = [ "docs/.*" ] but that did not work for me.

I then tried moving it before [permalinks] in my config.toml and it works. I don’t know why that would make a difference but it is working now.

I tried ignorefiles = [ "docs" ] again, and that works, so long as it is before [permalinks].

I am a bit surprised, I had not expected the order of config.toml statements to make a difference.

1 Like

Yes, in TOML the best way to make sure that your config options are interpreted correctly is to put them before any [table] definitions like params, permalinks, taxonomies, blackfriday, etc. Sorry, it didn’t even occur to me that might be the source of your problem.


1 Like


I have the same question and using TOML too
but for me it’s not working
I means the directory I want to ignore is font-awesome-v4.7.0 which come with the theme Agency
so I tried :

ignoreFiles = [ “themes/agency/static/font-awesome-v4.7.0” ]

ignoreFiles = [ “themes/agency/static/font-awesome-v4.7.0/*” ]

ignoreFiles = [ “static/font-awesome-v4.7.0” ]

ignoreFiles = [ “font-awesome-v4.7.0/*” ]

ignoreFiles = [ “font-awesome-v4.7.0” ]

ignoreFiles = [ “font-awesome-v4.7.0/*” ]

whithout any success
when I run hugo font-awesome-v4.7.0 always render as ** ./font-awesome-v4.7.0