diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-08-30 10:25:43 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-08-30 13:44:04 +0300 |
commit | 15d3e48cec8d732b97229cce1d03e88b74092636 (patch) | |
tree | 7ecbec44c8d2222c17fe56ae14c0126e626901f7 /hugolib | |
parent | b2a02c3c5ab3a5dc8c657d4a30c7b73aa4b93c3b (diff) |
Fix RegularPagesRecursive for the home page
Fixes #11396
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/page.go | 2 | ||||
-rw-r--r-- | hugolib/pagecollections_test.go | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/hugolib/page.go b/hugolib/page.go index 27a60a186..5b2411441 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -254,7 +254,7 @@ func (p *pageState) RegularPagesRecursive() page.Pages { p.regularPagesRecursiveInit.Do(func() { var pages page.Pages switch p.Kind() { - case kinds.KindSection: + case kinds.KindSection, kinds.KindHome: pages = p.getPagesRecursive() default: pages = p.RegularPages() diff --git a/hugolib/pagecollections_test.go b/hugolib/pagecollections_test.go index 1be296262..b11fc9899 100644 --- a/hugolib/pagecollections_test.go +++ b/hugolib/pagecollections_test.go @@ -432,3 +432,22 @@ Sect1 RegularPagesRecursive: page:/docs/sect1/ps1/|page:/docs/sect1/ps2/|page:/d `) } + +func TestRegularPagesRecursiveHome(t *testing.T) { + files := ` +-- hugo.toml -- +-- content/p1.md -- +-- content/post/p2.md -- +-- layouts/index.html -- +RegularPagesRecursive: {{ range .RegularPagesRecursive }}{{ .Kind }}:{{ .RelPermalink}}|{{ end }}|End. +` + + b := NewIntegrationTestBuilder( + IntegrationTestConfig{ + T: t, + TxtarString: files, + }).Build() + + b.AssertFileContent("public/index.html", `RegularPagesRecursive: page:/p1/|page:/post/p2/||End.`) + +} |