Sorry for bringing this up again, but I struggle to get the -e flag working. I have two environment specific config.toml files in config/stm and config/prod - only overriding the baseUrl. The main config is in config/_default/config.toml. And this is clearly picked up, but I am not able to merge in the environment specific baseUrls by running
% hugo -e stm
If I replace “stm” by some random string, I get no error either.
$ hugo env
Hugo Static Site Generator v0.59.0-1DD0C69C windows/amd64 BuildDate: 2019-10-21T09:40:37Z
GOOS=“windows”
GOARCH=“amd64”
GOVERSION=“go1.13.1”
I quickly the above and it works fine for me. What do you mean by “not working”?
I notice you’re using Windows – which could possibly explain this if this was a bug; but we have plenty of tests for this, and I would be surprised if not more people would complain …
That is correct behaviour. We don’t validate the environment string – you can have environment specific config, but you don’t have to.
A quck guess from me: The TOML spec requires that only map may follow a map, so if you put baseURL in the bottom (i.e. after a map) it will silently be ignored.
Also, I don’t think your lastmod config will work – see the frontmatter config element.
Thanks for following up on this. There may be things I still miss, but I was trying to achieve the same thing as I did with
% hugo --config config.toml,stm.toml
which worked. Here, stm.toml contained one line - an environment specific baseurl.
What I did, was to move config.toml to config/_default/config.toml and stml.toml to config/stm/config.toml and then
% hugo -e stm
which apparently picked up _default/config.toml, but did not merge with the one residing below “stm”.
I am perfectly fine with the first approach, but thought it would be nice to have all configuration in one place, and structured in terms of “environments”, which is excatly my use-case. So I would still like to understand why it does not work with config dirs for me. I can run Hugo on Linux to see if the behaviour is different?
I suspect there is some “detail wrong” in your setup. I don’t think this is a OS dependent bug. But it’s a little hard to “spot the detail” without the detail. If you point me to the repo/branch I could probably have a look at it.
You are so kind @bep! Yes, this is a private Bitbucket repo, but nothing confidential in it. I’ll send you a direct message with more info on how to clone it - only if you have time to take a look.