Iterate through nested front matter

I’m trying to use range to output a list of external links with their name and link.

I have set these as custom nested fields in the front matter, and hoped it would be the same as the {{ range .Site.Pages }} setup, but it doesn’t.

It just concatenates all the names as one single list item, and doesn’t use the hyperlinks at all.

Here is my front matter:

  - fname:
    - "Forbes"
    - "The New York Times"
  - flink:
    - ""
    - ""

And here is my layout:

		{{ range .Params.featured }}
			<a href="{{.flink}}">{{.fname}}</a>
		{{ end }}

What am I doing wrong?

Fixed it!

Changed my front matter format to:

  - fname: Forbes
    flink: ""
  - fname: "The New York Times"
    flink: ""

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