Theme config file without the need to declare it

A feature I think would be very handy to Hugo and the community is a dedicated theme config file (or at least the ability to have one). Right now Hugo does allow for multiple config files using the --config command, however, the biggest drawback is that you have to continually re-declare the configs using --config each time you serve or build the Hugo files – it’s not stored.

Also, one of the my ongoing complications is to have easy/live theme switching, this is mainly because each theme has it’s own config options – you can see this with any theme you download from hugo themes.

If we had the ability to use both the standard config.toml and a dedicated theme config like theme.config.toml without having to manually declare it, we could eliminate the need to continually replace or redirect config files. New users could adopt themes much faster and with less errors, and more advanced use cases would be menus that pertain to that theme (ie. a one page menu vs multi page menu).

Right now my automated approach to this is each theme has a theme.config.toml | yaml | json file in the theme/data/ folder, but this comes with it’s own headaches and drawbacks.

Funny you should ask …


This is being added in the upcoming release - am I reading that right? :crossed_fingers:

Or is it still in dev?

Regardless, I can’t wait for this support! This will make a huge difference and improvement.

This is being added in the upcoming release - am I reading that right?

Yes, it is not far away – orignally planned for today, but I stumbled upon some … hurdles. But a day or two and it will be out.


@bep - Will contentDir be available to us for the theme config file? I know this second config file will be limited on what it supports, but at least having the lower level contentDir could give us a workaround to allow themes have their own content and content sections. I know this isnt a perfect solution (thinking about posts not being shared across themes), but right now my biggest obstacle is easy theme switching since I use content sections almost exclusively now. And when themes do support content sections natively it would be an easy to remove the contentDir param and everything work as normal.