ref: 28031b0897d7b0f216f60983cb55bd62cc0e06bc
parent: a843d5d3bbc833f00b82647295ac8a7e50fa7da2
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Nov 17 05:29:11 EST 2016
node to page: Only return regular pages in home.Data.Pages Returning all types is both confusing and too breaking. All page types can be fetched in .Site.Pages. Updates #2297
--- a/hugolib/node_as_page_test.go
+++ b/hugolib/node_as_page_test.go
@@ -67,7 +67,7 @@
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 ",
@@ -184,8 +184,8 @@
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,
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -1466,7 +1466,7 @@
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 {