Skip to content

Commit

Permalink
Fix RegularPagesRecursive for the home page
Browse files Browse the repository at this point in the history
Fixes #11396
  • Loading branch information
bep committed Aug 30, 2023
1 parent b2a02c3 commit 15d3e48
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 19 additions & 0 deletions hugolib/pagecollections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.`)

}

0 comments on commit 15d3e48

Please sign in to comment.