Hugo generator deprecation warnings


I credit Hugo in my partials/head.html template with the following function. If you use software for free or donations, please consider doing so too:

{{ .Hugo.Generator }}

But since January it’s been throwing a warning:

Building sites … $TIME WARN Page's .Hugo is deprecated and will 
be removed in a future release. Use the global hugo function.

The official docs still show this as the correct syntax. But this forum thread by @zwbetz suggests one should change it to:

{{ hugo.Generator }}

This works without warnings. Note that it needs to be spelled lowercase, or you’ll get a different error:

Error: $FILE parse failed: template: $TEMPLATE:$LINE:
function "Hugo" not defined

Or if you replace it with something completely pointless:

Error: $FILE parse failed: template: $TEMPLATE:$LINE:
function "BirdIsTheWord" not defined

Author bio and support


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!