Something odd is happening to my Site.Data
calls, I get empty rows.
#data/moto.yaml
name: "Ron"
call : "http://www.ron.com"
loop:
- title: "Emperor"
- url: "motorola.com"
- img: "image.jpg"
- title: "Hello"
- url: "test.com"
- img: "image-2.jpg"
My call:
{{ $data := index .Site.Data .Params.Title }}
{{ $author := .Params.Title }}
{{ range .Site.Data }}
{{ if eq .name $author }}
{{ range .loop }}
<p>{{ .title }} {{ .img }} {{ .url }}</p>
{{ end }}
{{ end }}
{{ end }}
Now, this should print an entry per line, but instead prints
<p>Emperor motorola.com image.jpg</p>
<p></p>
<p></p>
<p>Hello test.com image-2.jpg</p>
I can fix with by using: {{ with .title }} {{ . }} {{ end }}
for each call, but… it is Ok that it repeats like that? Or I’m doing something wrong. Curious about it.