In my frontmatter, I have a syndicate_to
field. It can be a string
or a list of strings ([]string
):
syndicate_to = "some string"
or
syndicate_to = ["can also be", "an array"]
I would like to iterate over this value (to create links) but cannot discriminate bewteen the 2 cases.
{{ with .Params.foo }}
{{ if reflect.IsSlice . }}
{{ range . }}
{{ . }}
{{ end }}
{{ else }}
{{ . }}
{{ end }}
{{ end }}
https://gohugo.io/functions/reflect.isslice/
2 Likes
system
Closed
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.