Hello,
I have a rather strange problem. I have the following front matter:
contacts:
title: Talk to sales representative
phones:
- country: CH
- country: CH
- country: CH
email:
title: "You can also email us:"
I am trying to iterate the phones:
{{ range .Params.Contacts.Phones }}
<p class="text-white">{{ .country }}</p>
{{ end }}
On this I get the error can't evaluate field country in type interface {}. I know this is caused when Im trying to call property that does not exist. However the thing is that when I call simple {{ . }} on the template it renders map[country:CH]. It is obviously mapped and its there. In addition if I remove country: in the front matter so its not object in the array element, but only array element and use {{ . }} I get the CH. I really dont understand whats going on. I tried and searched for many things, but few lines below the same structure works perfectly without any errors and its even more deep:
form:
fields:
- type: email
placeholder: Email
required: true
- type: select
placeholder: Country
options:
- title: Austria
data: AT
- title: Germany
data: DE
- title: Switzerland
data: CH
- title: United kingdom
data: UK
- type: textarea
placeholder: Write us
moreinfo:
title: Get advanced support by providing some more details
fields:
- type: input
placeholder: Name
- type: input
placeholder: Website URL
Erm usually yes, but in this case this is not the problem. I tried uppercase, lowercase and a whole bunch of other things. The foreach works well if you replace {{ .country }} with {{ . }}.
Great. This means its somewhere deeper. Im afraid I cant expose the whole repo as it is in local gitlab and Im not allowed to.
However I can show you a gist with the full two files. I have the suspicion that this will not be enough though.
The version is the same
$ hugo env
Hugo Static Site Generator v0.36 darwin/amd64 BuildDate:
GOOS="darwin"
GOARCH="amd64"
GOVERSION=“go1.9.3”
Apparently there is something more going on here. We are using gulp for building multiple sites. Im not sure if this can be at fault. The amusing part is that literally few lines below (where I call the partial that generates form) it works without problem.