Show Hugo's version number in YAML file

Before v0.55: {{ .Hugo.Version }} works file in locale files i18n.*.yaml. However, .Hugo is deprecated since v0.55, so what can one use?

I tried {{ hugo.Version }}. This worked fine in Go-HTML template files, but Hugo can’t parse that in YAML files.

Error: "/home/vin100/beautifulhugo/i18n/ru.yaml:1:1": failed to load translations: unable to parse translation #14 because template: На базе <a href="http://gohugo.io">Hugo v{{ hugo.Version }}</a> &nbsp;&bull;&nbsp; Тема <a href="https://github.com/halogenica/beautifulhugo">Beautiful Hugo</a> на базе <a href="http://deanattali.com/beautiful-jekyll/">Beautiful Jekyll</a>:1: function "hugo" not defined
map[id:poweredBy translation:На базе <a href="http://gohugo.io">Hugo v{{ hugo.Version }}</a> &nbsp;&bull;&nbsp; Тема <a href="https://github.com/halogenica/beautifulhugo">Beautiful Hugo</a> на базе <a href="http://deanattali.com/beautiful-jekyll/">Beautiful Jekyll</a>]

P.S. I’m using Beautiful Hugo

Use {{ .Site.Hugo.Version }}

2 Likes

Thank you for your quick reply! It really works. I’ve created halogenical/beautifulhugo#269 for this.

1 Like