# Is it possible to have a section, list and single template for a content folder?

**URL:** <https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143>\
**Category:** support\
**Created:** [November 7, 2017, 6:35pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143 "2017-11-07T18:35:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![runhide](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@runhide](https://discourse.gohugo.io/u/runhide)\
**Post date:** [November 7, 2017, 6:35pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143/1 "2017-11-07T18:35:32Z")

</div>

Is it possible to have inside `layout > posts` a `section.html`, `list.html` and `single.html`?

Alternatively would it be possible to do the following:

`layout > section > posts.html`

`layout > posts > list.html, single.html`

I assume section is really a list so the `section.html` will “overwrite” `list.html`?

The reasoning behind my question is to have `section.html` be an index page and use `list.html to list all the content.

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [November 7, 2017, 9:51pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143/2 "2017-11-07T21:51:52Z")

</div>

Instead of thinking about the section, think of each HTML page generated, and each of those will have a separate [template lookup order](https://gohugo.io/templates/lookup-order/#lookup-orders).

It might seem strange, but the lookup order actually helps cut down on redundant code/templates.

So let’s say you have a section called `posts`:

- `example.org/posts/` uses the [section lookup](https://gohugo.io/templates/section-templates/#section-template-lookup-order)
- `example.org/posts/my-awesome-lunch/` uses the [single page lookup](https://gohugo.io/templates/single-page-templates/#single-page-template-lookup-order)

I am explaining this because I don’t quite understand your question, but I think understanding the lookup order will solve your issue, so you can figure out which template is loading.

For section, `/layouts/section/posts.html` will load _before_ `/layouts/posts/list.html` or `/layouts/_default/list.html`.

If you want to keep them next to each other, set your templates as:

- `/layouts/posts/list.html`
- `/layouts/posts/single.html`

And to clarify, a “section” is a type of “list”. It is built for a lot of flexibility, but you don’t need three templates for a section unless you are doing something fancy. 🙂

---

<div class="post-metadata">

**Author:** ![runhide](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@runhide](https://discourse.gohugo.io/u/runhide)\
**Post date:** [November 8, 2017, 1:18pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143/3 "2017-11-08T13:18:02Z")

</div>

I was trying to do something fancy… Thank you for this. All good now.

---

<div class="post-metadata">

**Author:** ![hnarayanan](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hnarayanan/32/4547_2.png) [@hnarayanan](https://discourse.gohugo.io/u/hnarayanan)\
**Post date:** [November 9, 2017, 2:46pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143/4 "2017-11-09T14:46:43Z")

</div>

I too am not clear as to your question, but from what I understand, you can do what you’re asking for.

See the following example: [https://github.com/hnarayanan/harishnarayanan.org/blob/master/layout/projects](https://github.com/hnarayanan/harishnarayanan.org/blob/master/layout/projects) where you can see the three kinds of layouts (with slightly different names) as in your example.

(This is independent of your question, but also note that that within this, you can filter by different sub kinds of content e.g. `{{ range where .Data.Pages "Params.category" "==" "website" }}`.)

Note that on another index page (like the home page), you can loop over all pages (across your different kinds of content) and get a complete list.

---

<div class="post-metadata">

**Author:** ![runhide](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@runhide](https://discourse.gohugo.io/u/runhide)\
**Post date:** [November 10, 2017, 2:09pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-have-a-section-list-and-single-template-for-a-content-folder/9143/5 "2017-11-10T14:09:51Z")

</div>

Thanks for the explanation and example
