Hello - I’m trying to make a shortcode to insert a date. Namely, I just want to insert this year. I tried a few things with {{ .Now.Year }}
, but nothing is working.
I’m getting hugo server console errors including things like:
ERROR: ... Date is not a field of struct type *hugolib.ShortcodeWithPage
ERROR: ... Now is not a field of struct type *hugolib.ShortcodeWithPage
ERROR: ... template: shortcodes/now.html:2: bad character U+0024 '$'
ERROR: ... error processing shortcode shortcodes/now.html
I’d like to call something like this:
{{< now Year >}}
… and pass Year or Date as the .Get 0
.
A shortcode now.html
with this content:
{{ $data := .Get 0 }}
{{ .Now.$data }}
… is not working.
Any ideas?