# List all pages under a sub-section folder

**URL:** https://discourse.gohugo.io/t/list-all-pages-under-a-sub-section-folder/6789
**Category:** support
**Created:** [May 31, 2017, 12:11pm UTC](https://discourse.gohugo.io/t/list-all-pages-under-a-sub-section-folder/6789 "2017-05-31T12:11:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![likanzhan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/likanzhan/32/3286_2.png) [@likanzhan](https://discourse.gohugo.io/u/likanzhan)
#### Post date: [May 31, 2017, 12:11pm UTC](https://discourse.gohugo.io/t/list-all-pages-under-a-sub-section-folder/6789/1 "2017-05-31T12:11:57Z")

</div>

My site has the following structure,

```auto
-- content /
     -- cn /
         -- post /
         -- teach /
     -- en /
         -- post /
         -- read /

```

And I want to list all the posts in the folder “content/cn/post” but not the posts in the folder “content/cn/teach”.  
But the rendered list contained all the posts both in “content/cn/post” and in “content/cn/teach”.  
What should I do to fulfill my aims?  
The following is the source code of my site: [https://github.com/rbind/likan](https://github.com/rbind/likan)  
Thanks.

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [May 31, 2017, 12:34pm UTC](https://discourse.gohugo.io/t/list-all-pages-under-a-sub-section-folder/6789/2 "2017-05-31T12:34:41Z")

</div>

Wait for the next release. See this [https://discuss.gohugo.io/t/feedback-wanted-nested-sections-content-structure/6692/23](https://discuss.gohugo.io/t/feedback-wanted-nested-sections-content-structure/6692/23)

---

<div class="post-metadata">

### Author: ![Leo\_Merkel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/leo_merkel/32/3321_2.png) [@Leo\_Merkel](https://discourse.gohugo.io/u/Leo_Merkel)
#### Post date: [May 31, 2017, 4:56pm UTC](https://discourse.gohugo.io/t/list-all-pages-under-a-sub-section-folder/6789/3 "2017-05-31T16:56:52Z")

</div>

You can try to generate a layout in `layouts/cn/post/list.html` and/or `layouts/cn/post/single.html`. You can even give it a custom name and reference it through the post’s Front Matter. Here’s Hugo’s Lookup Order: [Lookup Order](https://hugodocs.info/templates/lookup-order/).

---

<div class="post-metadata">

### Author: ![likanzhan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/likanzhan/32/3286_2.png) [@likanzhan](https://discourse.gohugo.io/u/likanzhan)
#### Post date: [June 1, 2017, 6:19am UTC](https://discourse.gohugo.io/t/list-all-pages-under-a-sub-section-folder/6789/4 "2017-06-01T06:19:43Z")

</div>

Thanks. And it seems that Leo’s methods don’t work. I finally came out a tricky way to have this down.  
I added a `where` function to filter the pages listed:  
`{{ range where .Pages "File.Dir" "in" "/cn/post/" }}`  
Really hope the next release will make this easier.

Thanks.
