Is it possible to define a map literal (or rough equivalent) in Hugo’s templates?
I’d like to do something roughly equivalent to (pseudocode combining Go + JS syntax):
{{ $map := { "a": 123, "b": 456 } }}
{{ range $elem_key, $elem_val := $map }}
{{ $elem_key }} -- {{ $elem_val }}
{{ end }}
What’s the correct syntax for defining $map
in this case?
Note: I put “literal” in quotes because I read somewhere that Go doesn’t support map literals. The key point is that I want to just play around with the data structure all in a single template without having to worry (yet) about the real datasource.