Range data from different subfolders

Hi everyone, I have following structure

data
    superparent
            parent1
                song1.yaml
                song2.yaml
            parent2
                song3.yaml
                song4.yaml
            parent3
                song5.yaml
                song6.yaml
layouts
    partials
        songs.html

Each song.yaml has a structure

- name: SongName
  date: some_date

I should range all the abovementioned songs.yaml from superparent/parent1, superparent/parent2, superparent/parent3 in one layout.partials/songs.html.
This what I came up with, but it doesn’t work

{{ range (and ($.Site.Data.superparent.parent1) ($.Site.Data.superparent.parent2) ($.Site.Data.superparent.parent3)) }}
    {{ range . }}
      <div>
        {{ .name }}
      </div>
    {{ end }}
{{ end }}

Can you, please, help me with the issue. Unfortunately, I can’t put all songs in one parent folder to make structure more flat, can’t change the structure of the data.

{{ range site.Data.superparent }}
  {{ range . }}
    {{ range . }}
      {{ .name }} ({{ .date | time.Format "2006" }})
    {{ end }}
  {{ end }}
{{ end }}
2 Likes

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