hugo version)?v0.58.1
Yes
There are at least two ways to set the environment to development or production in Hugo.
Many users are reporting very confusing behavior to us in the way that hugo.Environment ignores HUGO_ENV.
Surely, the following statement should be true if either HUGO_ENV="production" or if the -e production argument is provided, otherwise this behavior can be very confusing to users:
{{ if eq (hugo.Environment) "production" }}
You can use HUGO_ENVIRONMENT. Does the doc mention HUGO_ENV?
Thanks for clarifying.
It appears that both Netlify and Forestry use HUGO_ENV though, so it would be logical either they use HUGO_ENVIRONMENT or Hugo begins to understand HUGO_ENV as the Hugo.Environment?
See
You could start by removing the big BUG in the title, then, as this is obviously not that.
Currently, the official Hugo website only appears to mention HUGO_ENV (in the link above) and not HUGO_ENVIRONMENT, hence it appeared to be a bug. Thanks for clarifying that it's an inconsistent use of environment within the community, and I've updated the title to reflect that :)
I assume it would be beneficial to support HUGO_ENV as an environment in Hugo since a large number of Hugo powered Netlify and Forestry sites already use this approach.
Whereas there are only ~17 files on GitHub containing HUGO_ENVIRONMENT.
Perhaps you might find the above compelling enough to listen to the community on this one and warrant supporting HUGO_ENV as an environment?
+1 for supporting HUGO_ENV.
Most helpful comment
FYI GitHub states that there are currently ~16,500 files (very rough max. proxy for sites) using the
HUGO_ENVapproach.Whereas there are only ~17 files on GitHub containing
HUGO_ENVIRONMENT.Perhaps you might find the above compelling enough to listen to the community on this one and warrant supporting
HUGO_ENVas an environment?