# How to list posts from a designated contents sub-folder

**URL:** <https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334>\
**Category:** support\
**Created:** [February 3, 2018, 4:25am UTC](https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334 "2018-02-03T04:25:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JellisHeRo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jellishero/32/4633_2.png) [@JellisHeRo](https://discourse.gohugo.io/u/JellisHeRo)\
**Post date:** [February 3, 2018, 4:25am UTC](https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334/1 "2018-02-03T04:25:40Z")

</div>

With Hugo 0.34, ghostwriter theme now displays all my posts, including my about and contact pages, which is concerning because I just want my blog posts to be listed.

In my content folder, like the base ghostwriter example site, there are the page, post, and project folders. Before version 0.34, all my listed posts were my blog posts from the /post folder.

I figured there has to be some way to work around this, and so I went to the layouts and I found the template for my blog list.

```
<ol class="post-list">
    {{ $pag := .Paginate .Data.Pages }}
    {{ range $pag.Pages }}
        {{ partial "post-stub.html" . }}
    {{ end }}
</ol>

```

I think it has to do with the `$pag.Pages` and `Data.Pages`, but I dont know how I can alter this to call from a specific subfolder, namely post. Any tips?

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [February 3, 2018, 5:08am UTC](https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334/2 "2018-02-03T05:08:06Z")

</div>

Check out the [Introduction to templates](https://gohugo.io/templates/introduction/)… look for `range where` examples, there and in this forum too. There are many!

---

<div class="post-metadata">

**Author:** ![holmser](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/holmser/32/5305_2.png) [@holmser](https://discourse.gohugo.io/u/holmser)\
**Post date:** [February 20, 2018, 7:01pm UTC](https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334/3 "2018-02-20T19:01:19Z")

</div>

I just ran into this as well. Did you ever figure out what it was?

---

<div class="post-metadata">

**Author:** ![deveth0](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/deveth0/32/9710_2.png) [@deveth0](https://discourse.gohugo.io/u/deveth0)\
**Post date:** [June 12, 2019, 6:54am UTC](https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334/4 "2019-06-12T06:54:08Z")

</div>

Might be a bit late, but hey…

If you only want to display pages which are in a defined section (e.g. posts), you can use `range where`:

```auto
{{ range where .Pages "Section" "posts" }}
{{ .Title }}
{{ end }}

```

---

<div class="post-metadata">

**Author:** ![ansuf](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ansuf/32/11188_2.png) [@ansuf](https://discourse.gohugo.io/u/ansuf)\
**Post date:** [April 25, 2020, 9:24am UTC](https://discourse.gohugo.io/t/how-to-list-posts-from-a-designated-contents-sub-folder/10334/5 "2020-04-25T09:24:03Z")

</div>

thanks for your help, but I modified a little thing

```
{{ range where .Pages "Section" "posts" }}
{{ range .Pages
{{ .Title }}
{{ end }}
{{ end }}
```
