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

Panic when cascading headless from site config to section that does not have an _index.md file #12172

Closed
jmooring opened this issue Feb 28, 2024 · 2 comments

Comments

@jmooring
Copy link
Member

content

content/
└── s1/
    └── p1.md

config

[[cascade]]
headless = true
[cascade._target]
path = '/s1**'

Hugo v0.122.0 emitted this warning...

WARN .File.TranslationBaseName on zero object. Wrap it in if or with: {{ with .File }}{{ .TranslationBaseName }}{{ end }}

...but still published s1/p1 (which I think was wrong too).

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

	files := `
-- hugo.toml --
disableKinds = ['rss','sitemap','taxonomy','term']
[[cascade]]
headless = true
[cascade._target]
path = '/s1**'
-- content/s1/p1.md --
---
title: p1
---
-- layouts/_default/single.html --
{{ .Title }}|
-- layouts/_default/list.html --
{{ .Title }}|
  `
	b := hugolib.Test(t, files)

	b.AssertFileExists("public/index.html", true)
	b.AssertFileExists("public/s1/index.html", false)
	b.AssertFileExists("public/s1/p1/index.html", false)
}

@bep bep removed the NeedsTriage label Feb 28, 2024
@bep bep self-assigned this Feb 28, 2024
@bep bep added this to the v0.123.5 milestone Feb 28, 2024
bep added a commit to bep/hugo that referenced this issue Feb 28, 2024
bep added a commit to bep/hugo that referenced this issue Feb 28, 2024
@bep bep closed this as completed in fce8d82 Feb 28, 2024
@AlanBreck
Copy link

Thank you for the prompt fix!

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 21, 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