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/_default/author.terms.html #12193

Closed
earthboundkid opened this issue Mar 1, 2024 · 5 comments
Closed

Comments

@earthboundkid
Copy link
Contributor

My /authors/ page no longer uses the layouts/_defaults/author.terms.html layout with Hugo 123. Renaming the file to authors.terms.html fixes the issue, but the actual taxonomy is defined as

[taxonomies]
  author = "authors"

See #12174.

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.123.7-312735366b20d64bd61bff8627f593749f86c964+extended darwin/arm64 BuildDate=2024-03-01T16:16:06Z VendorInfo=brew

Does this issue reproduce with the latest release?

Yes.

@earthboundkid
Copy link
Contributor Author

earthboundkid commented Mar 1, 2024

Interestingly, author.html works for individual author pages, but authors.html does not. Seems like they should probably either both work with S or both work without S or both work with either.

@jmooring
Copy link
Member

jmooring commented Mar 1, 2024

I'm probably missing a key piece of this, but I am unable to reproduce the problem.

Site config

[taxonomies]
author = 'authors'

Content

authors = ['John Smith','Robert Smith']

Layouts

layouts/
└── _default/
    ├── author.terms.html <-- renders the authors taxonomy page
    ├── baseof.html
    ├── home.html
    ├── list.html
    └── single.html

Test site

git clone --single-branch -b hugo-github-issue-12193 https://github.com/jmooring/hugo-testing hugo-github-issue-12193
cd hugo-github-issue-12193
rm -rf public && hugo && cat public/authors/index.html

@earthboundkid
Copy link
Contributor Author

Make a content/authors/_index.md and the bug will reproduce.

@jmooring
Copy link
Member

jmooring commented Mar 1, 2024

Perfect. Thanks. This is very similar to #12146.

Test case
func TestFoo(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap']
[taxonomies]
author = 'authors'
-- layouts/_default/list.html --
{{ .Title }}|
-- layouts/_default/author.terms.html --
layouts/_default/author.terms.html
-- content/authors/_index.md --
---
title: Authors Page
---
`

	b := hugolib.Test(t, files)

	b.AssertFileExists("public/index.html", true)
	b.AssertFileExists("public/authors/index.html", true)
	b.AssertFileContent("public/authors/index.html", "layouts/_default/author.terms.html") // failing test
}

@jmooring jmooring changed the title Hugo v123 ignore .terms layout file Template lookup order no longer finds layouts/_default/author.terms.html Mar 1, 2024
@bep bep self-assigned this Mar 7, 2024
@bep bep added this to the v0.123.8 milestone Mar 7, 2024
bep added a commit to bep/hugo that referenced this issue Mar 7, 2024
@bep bep closed this as completed in 0567a3e Mar 7, 2024
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 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants