Questions related to the Config Dir feature

I’m starting this thread so people can share their questions regarding the soon to be documented Hugo .53 feature for managing configuration through a set of config dir and files (see GitHub Issue)

I’ll start with mine:

Is there a way to retrieve the environment key or the value of the --environment tag?
Current workaround is to add a env as config parameter, but as we have default env keys (development for hugo serve, production for hugo), I guess we should be able to get those out of the box.

Maybe getenv could accept 0 parameter and return the environment key in such case?

If I’m understanding you right, you can do this in your templates like

{{ hugo.Environment }}
1 Like

Thanks! @zwbetz! Makes a lot of sense!

1 Like