# Get pages from multiple sections in one list

**URL:** https://discourse.gohugo.io/t/get-pages-from-multiple-sections-in-one-list/15271
**Category:** support
**Created:** [November 13, 2018, 1:38pm UTC](https://discourse.gohugo.io/t/get-pages-from-multiple-sections-in-one-list/15271 "2018-11-13T13:38:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mv-100](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@mv-100](https://discourse.gohugo.io/u/mv-100)
#### Post date: [November 13, 2018, 1:38pm UTC](https://discourse.gohugo.io/t/get-pages-from-multiple-sections-in-one-list/15271/1 "2018-11-13T13:38:55Z")

</div>

I have a folder in “content” called “projects” which has sub folders and also sub-sub folders. I’m trying to get the latest 12 pages content of all the sub-sub folders to show in a single list by date order.

My current code:

```
<ul>
    {{ range .Sections }}
        <li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
            {{ range .Sections }}
                {{ range first 12 .Pages }}
                    <ul>
                        <li><a href="{{ .RelPermalink}}">{{ .Title }}</a></li>
                    </ul>
                {{ end }}
            {{ end }}
        </li>
    {{ end }}
</ul>

```

This shows the first 12 pages from each sub-sub section. I need to get them all in one list and only show the latest 12 regardless or which sub-sub section they are in

---

<div class="post-metadata">

### Author: ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)
#### Post date: [November 13, 2018, 10:49pm UTC](https://discourse.gohugo.io/t/get-pages-from-multiple-sections-in-one-list/15271/2 "2018-11-13T22:49:44Z")

</div>

> [@mv-100](#):
>
> all in one list and only show the latest 12 regardless or which sub-sub section they are in

Something like this should work:

```auto
{{ range first 12 ( sort (where .Site.RegularPages "Section" "projects") "Date" "desc" ) }}
  {{ . }}
{{ end }}

```

---

<div class="post-metadata">

### Author: ![rdwatters](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rdwatters/32/2848_2.png) [@rdwatters](https://discourse.gohugo.io/u/rdwatters)
#### Post date: [November 14, 2018, 2:37am UTC](https://discourse.gohugo.io/t/get-pages-from-multiple-sections-in-one-list/15271/3 "2018-11-14T02:37:08Z")

</div>

> **[Lists of Content in Hugo](https://gohugo.io/templates/lists/#group-content)**
>
> Lists have a specific meaning and usage in Hugo when it comes to rendering your site homepage, section page, taxonomy list, or taxonomy terms list.

---

<div class="post-metadata">

### Author: ![mv-100](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@mv-100](https://discourse.gohugo.io/u/mv-100)
#### Post date: [November 14, 2018, 2:17pm UTC](https://discourse.gohugo.io/t/get-pages-from-multiple-sections-in-one-list/15271/4 "2018-11-14T14:17:25Z")

</div>

My folder structure is like this:

projects  
— project 1  
------- folder 1  
---------- content 1  
---------- content 2  
---------- content 3

------- folder 2  
---------- content 4  
---------- content 5

------- folder 3  
---------- content 6  
---------- content 7

— project 2  
— project 3

“project 1” should show content 1 - 7 (based on date order) on the list page for “project 1”. It also needs to be dynamic so I can use it for multiple sections
