Hi there! I’m new here. I started using Hugo a few weeks ago. I’ve never programmed in Go before but the documentation is really very good and I’ve been able to solve all my own problems so far. I’ve run into a bit of a weird issue, though, I thought I’d seek help on as I can’t find the exact answer on these forums.
In my frontmatter, I have a list within a map key within a list whose type is returning as []interface {}
. This isn’t a problem as it works fine with range
, but it does not work with delimit
which is what I’m looking to use. However, when I create a list at the top level, it has type []string {}
. I’m unsure if this is expected behaviour or I’m missing something or doing something else wrong.
Here is my code (the culprit is the roles
key):
---
players:
- name: Bob
roles: [guitar bass vocals]
---
{{ range .Params.players }}
{{ printf "%T" .roles }} {{/* This outputs `[]interface {}` */}}
{{ end }}
Compare this to:
---
test: [one two three]
---
{{ printf "%T" .Params.test }} {{/* This outputs `[]string {}` */}}
Any insight would be much appreciated!
I do have a work-around for this (mutating a $delim
variable like I did way back in my PHP days) but it would be nice to be able to use delimit
.
Thanks, y’all!