# Template lookup order problem

**URL:** <https://discourse.gohugo.io/t/template-lookup-order-problem/55440>\
**Category:** support\
**Tags:** layouts\
**Created:** [July 27, 2025, 1:57am UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440 "2025-07-27T01:57:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shawndo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/shawndo/32/24937_2.png) [@shawndo](https://discourse.gohugo.io/u/shawndo)\
**Post date:** [July 27, 2025, 1:57am UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/1 "2025-07-27T01:57:25Z")

</div>

Hello all,  
I’m having trouble getting the theme layout right to match the simple content structure.

From what I’ve read, the `layouts/posts/page.html` should match up to the `blog*.md` content and the `layouts/page.html` should match up with the `about-me.md` but it isn’t working. It’s ignoring the `posts/page.html`.

I think i must be missing something about the order of priority or something. I saw that the template system was recently overhauled and wondering if there might be something basic I’m missing in the documentation.  
its fairly simple:

```auto
content
├── about-me.md
└── posts
    ├──blog1.md
    ├──blog2.md
    └──blog3.md

themes
└── themeName
    └── layouts
        ├── baseof.html
        ├── home.html
        ├── page.html
        ├── _partials
        │ ├── footer.html
        │ ├── head
        │ │ ├── css.html
        │ │ └── lightboxjs.html
        │ ├── header.html
        │ ├── head.html
        │ └── menu.html
        ├── posts
        │ └── page.html
        ├── section.html
        ├── taxonomy.html
        └── term.html

```

---

<div class="post-metadata">

**Author:** ![tyco](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/tyco/32/23754_2.png) [@tyco](https://discourse.gohugo.io/u/tyco)\
**Post date:** [July 27, 2025, 7:14am UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/2 "2025-07-27T07:14:16Z")

</div>

> [@shawndo](#):
>
> From what I’ve read, the `layouts/posts/page.html` should match up to the `blog*.md` content and the `layouts/page.html` should match up with the `about-me.md` but it isn’t working. It’s ignoring the `posts/page.html`.

What is not working? Your question is unclear. Also see [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132#let-us-see-your-code-8).

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [July 27, 2025, 7:20am UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/3 "2025-07-27T07:20:10Z")

</div>

I’m unable to reproduce your issue with latest hugo version 0.148.1

seems there is something within different at your site. If you cannot figure that out sharing your repo will be easiest to support you.

try it out here:

```auto
git clone --single-branch -b topic-55440-about-me https://github.com/irkode/hugo-forum.git topic-55440-about-me
cd topic-55440-about-me
hugo server

```

Logfile and structure

```auto
hugo v0.148.1-98ba...
WARN Topic 55440 About Me -- mysite\themes\mytheme\layouts\home.html
WARN About Me -- mysite\themes\mytheme\layouts\page.html
WARN Posts -- mysite\themes\mytheme\layouts\section.html
WARN Blog 2 -- mysite\themes\mytheme\layouts\posts\page.html
WARN Blog 1 -- mysite\themes\mytheme\layouts\posts\page.html
WARN Blog 3 -- mysite\themes\mytheme\layouts\posts\page.html

```

```auto
content
│ about-me.md
└───posts
        blog1.md
        blog2.md
        blog3.md

```

```auto
themes
└───mytheme
    └───layouts
        │ baseof.html
        │ home.html
        │ page.html
        │ section.html
        │
        └───posts
                page.html

```

or maybe did not understand your problem 😉

* * *

p.s. in general you want to have something more to show on your section pages but the layouts rendered. a `content/_index.md` and `content/posts/_index.md` might be valuable.

---

<div class="post-metadata">

**Author:** ![shawndo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/shawndo/32/24937_2.png) [@shawndo](https://discourse.gohugo.io/u/shawndo)\
**Post date:** [July 27, 2025, 2:47pm UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/4 "2025-07-27T14:47:51Z")

</div>

thank you @irkode the sample code helped out. My content had “type” front matter that was screwing this up. When i removed it, it works as expected.

Specifically the blog\*.md files had a frontmatter `type: post` which made it ignore the `layout\posts` path and defaulted to the root page.html. It didn’t occur to me the frontmatter type has a higher priority than the path.

I just had to rename the `layout/posts` path to `layout/post` to reference the frontmatter instead of the path and it worked.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [July 27, 2025, 3:03pm UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/5 "2025-07-27T15:03:21Z")

</div>

in your shown part there is nothing inside the layouts that would resolve a type “post”

and with that in the [layout order docs](https://gohugo.io/templates/new-templatesystem-overview/#changes-to-template-lookup-order)

> The `type` set in front matter will effectively replace the `section` folder in [Page path](https://gohugo.io/methods/page/path/) when doing lookups.

you will have something like a lookup for `/layouts/post/....` which does not exist and so `hugo` takes the next less specific match 😉

you could have changed the type to `posts` - a simple **s** matters 😉

---

<div class="post-metadata">

**Author:** ![shawndo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/shawndo/32/24937_2.png) [@shawndo](https://discourse.gohugo.io/u/shawndo)\
**Post date:** [July 27, 2025, 3:08pm UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/6 "2025-07-27T15:08:54Z")

</div>

yes, i never knew `type` frontmatter would override the section. In fact, he definition of type says that’s pretty much its whole purpose:

> content type  
> A _content type_ is a classification of content inferred from the top-level directory name or the `type` set in [front matter](https://gohugo.io/quick-reference/glossary/#front-matter). Pages in the root of the `content` directory, including the home page, are of type “page”. The content type is a contributing factor in the template lookup order and determines which [archetype](https://gohugo.io/content-management/archetypes/) template to use when creating new content.

This content was imported from a wordpress blog and i guess the conversion tool auto-inserted that and I didn’t understand the implication. I will be removing all type frontmatter so it just follows the path.

thanks!

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [July 27, 2025, 3:13pm UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/7 "2025-07-27T15:13:39Z")

</div>

hope you are aware of the new template system that came with v0.146. there’s a one pager in the docs about that.

so behavior might have been differently before.

---

<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:** [July 29, 2025, 3:14pm UTC](https://discourse.gohugo.io/t/template-lookup-order-problem/55440/8 "2025-07-29T15:14:32Z")

</div>

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