Template lookup problem with v0.146.1

Template lookup order for layouts/section/section.html and layouts/taxonomy/list.html is invalid on 0.146.1.

WARN  found no layout file for "html" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

Here’s a test site:

git clone --single-branch -b hugo-forum-topic-54309 https://github.com/jmooring/hugo-testing hugo-forum-topic-54309
cd hugo-forum-topic-54309
hugo server

That works as expected.

That one does not work. I’m not sure if this is an intentional breaking change.

cc @bep

I would structure the layouts directory like this:

layouts/
β”œβ”€β”€ _markup/
β”‚   └── render-blockquote.html
β”œβ”€β”€ _partials/
β”‚   └── foo.html
β”œβ”€β”€ _shortcodes/
β”‚   └── bar.html
β”œβ”€β”€ baseof.html
β”œβ”€β”€ home.html
β”œβ”€β”€ list.html
β”œβ”€β”€ single.html
β”œβ”€β”€ taxonomy.html
└── term.html

layouts/taxonomy/list.html

I have both layouts/taxonomy/terms.html and layouts/taxonomy/list.html.

I hope layouts/taxonomy/terms.html for taxonomy templates and layouts/taxonomy/list.html for term templates, but layouts/taxonomy/list.htmlnot works as expected.

refer to: Template lookup order

@jmooring Click Reproduce the problem for topic-54309 by Lruihao Β· Pull Request #11 Β· jmooring/hugo-testing Β· GitHub to reproduce the problem.

See the recommendation in my previous reply.

I have adjusted the template, but I think we should report this incompatible bug instead of letting every Hugo user adjust it.

  1. This is a v2 of the template system. You are supposed to upgrade your templates to the new setup.
  2. I spent lots of time trying to map the old logic into the new setup. This is logic built up over a decade that’s complex and very hard to understand. I think I got it mostly right, but you have discovered a hole.

Unless a very common construct, we (I) are not spending time adjusting the new setup to be compatible.

I assumed that there would be some level of noise in this release, but we really needed to do this. A general advice to people who see issues like the above:

  • If there’s an easy and obvious adjustment, do that.
  • Else, use the previous Hugo version for a while, until better documentation about how the new works and how to adjust.

OK, that looks common enough that we should support it.

1 Like

This was resolved in v0.146.2.

1 Like

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