Closed jhenstridge closed 1 year ago
Exactly, if we do this, then Ananke would treat any website with the default hugo
command line as a production site. Any deploy preview etc... would be considered production.
It's an easy code change, but a difficult effort in communication to make sure everyone gets the memo.
@regisphilibert I found this today! I'd say it would be worth it to document it at least as this theme is used in the getting started tutorial from Hugo. It can be confusing since it kinds of conflicts with what's specified in the docs.
BTW, I got the memo lol
Hugo has built-in support for multiple build environments that is exposed to templates via the
hugo.Environment
andhugo.IsProduction
variables. This is controlled via the--environment
command line argument with theHUGO_ENV
environment variable as a fallback.Ananke has some support for build environments, but it does it by checking the
HUGO_ENV
environment variable directly:https://github.com/theNewDynamic/gohugo-theme-ananke/blob/5a8b531a7ce2f22eaa452ebab8325040982c9275/layouts/_default/baseof.html#L12
This means Ananke's view of the build environment will match Hugo's if it was set by the environment variable but not if it was set via the command line.
It looks like this could be simplified to just using
hugo.IsProduction
. This would result in a change in behaviour when no environment is set at all. According to the docs, here are the results: