I am having trouble rebuilding after attempting to add the Hugo version onto my site in a markdown file.
{{ .Hugo.Version }} called in an HTML template works correctly (eg. /_default/single.html).
But {{ .Hugo.Version }} in shortcodes/version.html and called as {{< version >}} in an .md file doesn’t work.
Error: execute of template failed: template: shortcodes/version.html:1:11: executing "shortcodes/version.html" at <.Hugo.Version>: can't evaluate field Hugo in type *hugolib.ShortcodeWithPage
Wondering if I’ve missed a step here or have the syntax incorrect. I’ve done a similar shortcode thing to put HTML in markdown other pieces of code and it works fine!
Shortcodes and partials don’t work for me
try workaround to set {{.Scratch.Set “Version” .Hugo.Version}} in an header partial.
The Shortcode should read this {{.Scratch.Get “Version”}}
Sorry for the short answer, in Germany is it now 00:19 time for bed
Yes, sorry about that - I said partial when I meant shortcode.
I think I get it - shortcodes just need a little extra info to work. I think I was just confused because https://gohugo.io/variables/hugo/ doesn’t mention the page bit.
Thanks @bep, that’s great it’s going into future improvements.