# Range data from different subfolders

**URL:** <https://discourse.gohugo.io/t/range-data-from-different-subfolders/42877>\
**Category:** support\
**Created:** [February 9, 2023, 3:09pm UTC](https://discourse.gohugo.io/t/range-data-from-different-subfolders/42877 "2023-02-09T15:09:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bullet](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@bullet](https://discourse.gohugo.io/u/bullet)\
**Post date:** [February 9, 2023, 3:09pm UTC](https://discourse.gohugo.io/t/range-data-from-different-subfolders/42877/1 "2023-02-09T15:09:00Z")

</div>

Hi everyone, I have following structure

```auto
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

```auto
- 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

```auto
{{ 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.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 9, 2023, 4:35pm UTC](https://discourse.gohugo.io/t/range-data-from-different-subfolders/42877/2 "2023-02-09T16:35:53Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [February 11, 2023, 4:36pm UTC](https://discourse.gohugo.io/t/range-data-from-different-subfolders/42877/3 "2023-02-11T16:36:17Z")

</div>

Closed on February 11, 2023, 4:36pm UTC

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