Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template lookup order no longer finds layouts/taxonomy/tag.html #12146

Closed
jmooring opened this issue Feb 24, 2024 · 4 comments · Fixed by #12150
Closed

Template lookup order no longer finds layouts/taxonomy/tag.html #12146

jmooring opened this issue Feb 24, 2024 · 4 comments · Fixed by #12150

Comments

@jmooring
Copy link
Member

jmooring commented Feb 24, 2024

This worked with v0.122.0 and earlier:

layouts/taxonomy/tag.html

That template is not found with v0.123.0 and later.

These don't work either:

  • layouts/_default/tag.html
  • layouts/_default/tag.html.html
  • layouts/taxonomy/tag.html.html

Reference: https://discourse.gohugo.io/t/0-123-removed-my-tag-descriptions/48462

@bep bep added this to the v0.123.4 milestone Feb 25, 2024
@bep bep self-assigned this Feb 25, 2024
@bep
Copy link
Member

bep commented Feb 25, 2024

Hmm. This test passes:

func TestTaxonomiesTermLookup(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
baseURL = "https://example.com"
[taxonomies]
tag = "tags"
-- content/_index.md --
---
title: "Home"
tags: ["a", "b"]
---
-- layouts/taxonomy/tag.html --
Tag: {{ .Title }}|
`
	b := Test(t, files)
	b.AssertFileContent("public/tags/a/index.html", "Tag: A|")
}

?

@jmooring
Copy link
Member Author

jmooring commented Feb 25, 2024

The rest of the story...

-- content/tags/a/_index.md --
---
title: tag-a-title-override
---

I should have included that detail in the initial report. Sorry about that.

bep added a commit to bep/hugo that referenced this issue Feb 25, 2024
theory added a commit to theory/justatheory that referenced this issue Mar 5, 2024
I added them in f53d6f8, but then noticed that the Perl and Postgres
HTML pages were displaying the HTML layout for `/tags`, not `/tas/term`.
After troubleshooting it for a while, I finally realized the problem
went away by upgrading from Hugo v0.123.3 to v0.123.7. Looks like it was
a bug, gohugoio/hugo#12146, fixed in gohugoio/hugo#12150 and released in
v0.123.4. Phew!
@theory
Copy link
Contributor

theory commented Mar 5, 2024

Oh man, thank you for figuring this out and getting it fixed. It was kicking my ass! template path resolution gets complicated quickly.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants