Description
When running hugo new
the environment set in the configuration or via ENV is ignored.
I run into it as created files were not placed into the correct directory anymore (updated from v0.111.3)
I got several environments, named technical-manual
, operation-manual
and customer
(and _default
)
I'm setting HUGO_ENVIRONMENT=technical-manual
, thus the config picks it up successfully:
$ hugo config | grep -i env
environment = 'technical-manual'
However, when running hugo new
I'm getting different results:
$ hugo new changelogs/unreleased/foobar.md
Content "/project/content/operation-manual/changelogs/unreleased/foobar.md" created
directory is equal to
$ HUGO_ENVIRONMENT=technical-manual hugo new changelogs/unreleased/foobar.md
Content "/project/content/operation-manual/changelogs/unreleased/foobar.md" created
but differs to
$ hugo new -e technical-environment changelogs/unreleased/foobar.md
Content "/project/content/changelogs/unreleased/foobar.md" created
You can see, that the first two commands produces a different result than the last one.
The last command would be the expected one.
I tried to workaround this issue by specifying --directory
but with no result. In contrast, it seems to ignore this parameter alltogether as the two following ones do not make any difference:
$ hugo new --destination content/changelogs/unreleased/ foobar.md
Content "/project/content/operation-manual/foobar.md" created
$ hugo new --destination changelogs/unreleased/ foobar.md
Content "/project/content/operation-manual/foobar.md" created
What version of Hugo are you using (hugo version
)?
$ hugo version hugo v0.147.3+extended+withdeploy linux/amd64 BuildDate=unknown VendorInfo=docker
Does this issue reproduce with the latest release?
yes