Get list in shortcut


I’m new to Hugo and I’m developing some shortcuts.
one of these should read an array in one of the formats, possibly yaml or json
I wanted to know if it’s possible to do a genre thing…

{{< exList >}}
{{< /exList }}

or in yaml

{{< exList >}}
- id: a1
- id: a2
- id: a3
{{< /exList }}

so in the template

{{ range .Inner | jsonify  }}
 {{ .id }}
{{ end }}

or in yaml

Do you think it’s possible?

Yes, but not with jsonify as it turns an object into a json string. What you’re looking for is transform.Unmarshal.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.