mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Fix panic when cascading headless from site config to section that does not have an _index.md file
Fixes #12172
This commit is contained in:
@@ -766,3 +766,29 @@ path = '/p1.md'
|
||||
b := Test(t, files)
|
||||
b.AssertLogNotContains(`looks like a path with an extension`)
|
||||
}
|
||||
|
||||
func TestCascadeIssue12172(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 := Test(t, files)
|
||||
|
||||
b.AssertFileExists("public/index.html", true)
|
||||
b.AssertFileExists("public/s1/index.html", false)
|
||||
b.AssertFileExists("public/s1/p1/index.html", false)
|
||||
}
|
||||
|
@@ -523,7 +523,7 @@ params:
|
||||
// pages.
|
||||
isHeadless := cast.ToBool(v)
|
||||
params[loki] = isHeadless
|
||||
if p.File().TranslationBaseName() == "index" && isHeadless {
|
||||
if isHeadless {
|
||||
pm.pageConfig.Build.List = pagemeta.Never
|
||||
pm.pageConfig.Build.Render = pagemeta.Never
|
||||
}
|
||||
|
Reference in New Issue
Block a user