Skip to content

Commit

Permalink
node to page: Only return regular pages in home.Data.Pages
Browse files Browse the repository at this point in the history
Returning all types is both confusing and too breaking.

All page types can be fetched in .Site.Pages.

Updates #2297
  • Loading branch information
bep committed Nov 22, 2016
1 parent a843d5d commit 28031b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions hugolib/node_as_page_test.go
Expand Up @@ -67,7 +67,7 @@ func TestNodesAsPage(t *testing.T) {
assertFileContent(t, filepath.Join("public", "index.html"), false,
"Index Title: Home Sweet Home!",
"Home <strong>Content!</strong>",
"# Pages: 9",
"# Pages: 4",
"Date: 2009-01-02",
"Lastmod: 2009-01-03",
"GetPage: Section1 ",
Expand Down Expand Up @@ -184,8 +184,8 @@ func TestNodesWithNoContentFile(t *testing.T) {
require.Len(t, homePages, 1)

homePage := homePages[0]
require.Len(t, homePage.Data["Pages"], 9)
require.Len(t, homePage.Pages, 9) // Alias
require.Len(t, homePage.Data["Pages"], 4)
require.Len(t, homePage.Pages, 4)
require.True(t, homePage.Path() == "")

assertFileContent(t, filepath.Join("public", "index.html"), false,
Expand Down
2 changes: 1 addition & 1 deletion hugolib/page.go
Expand Up @@ -1466,7 +1466,7 @@ func (p *Page) prepareData(s *Site) error {
switch p.Kind {
case KindPage:
case KindHome:
pages = s.findPagesByKindNotIn(KindHome, s.Pages)
pages = s.RegularPages
case KindSection:
sectionData, ok := s.Sections[p.sections[0]]
if !ok {
Expand Down

0 comments on commit 28031b0

Please sign in to comment.