mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
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
This commit is contained in:
@@ -67,7 +67,7 @@ func TestNodesAsPage(t *testing.T) {
|
|||||||
assertFileContent(t, filepath.Join("public", "index.html"), false,
|
assertFileContent(t, filepath.Join("public", "index.html"), false,
|
||||||
"Index Title: Home Sweet Home!",
|
"Index Title: Home Sweet Home!",
|
||||||
"Home <strong>Content!</strong>",
|
"Home <strong>Content!</strong>",
|
||||||
"# Pages: 9",
|
"# Pages: 4",
|
||||||
"Date: 2009-01-02",
|
"Date: 2009-01-02",
|
||||||
"Lastmod: 2009-01-03",
|
"Lastmod: 2009-01-03",
|
||||||
"GetPage: Section1 ",
|
"GetPage: Section1 ",
|
||||||
@@ -184,8 +184,8 @@ func TestNodesWithNoContentFile(t *testing.T) {
|
|||||||
require.Len(t, homePages, 1)
|
require.Len(t, homePages, 1)
|
||||||
|
|
||||||
homePage := homePages[0]
|
homePage := homePages[0]
|
||||||
require.Len(t, homePage.Data["Pages"], 9)
|
require.Len(t, homePage.Data["Pages"], 4)
|
||||||
require.Len(t, homePage.Pages, 9) // Alias
|
require.Len(t, homePage.Pages, 4)
|
||||||
require.True(t, homePage.Path() == "")
|
require.True(t, homePage.Path() == "")
|
||||||
|
|
||||||
assertFileContent(t, filepath.Join("public", "index.html"), false,
|
assertFileContent(t, filepath.Join("public", "index.html"), false,
|
||||||
|
@@ -1466,7 +1466,7 @@ func (p *Page) prepareData(s *Site) error {
|
|||||||
switch p.Kind {
|
switch p.Kind {
|
||||||
case KindPage:
|
case KindPage:
|
||||||
case KindHome:
|
case KindHome:
|
||||||
pages = s.findPagesByKindNotIn(KindHome, s.Pages)
|
pages = s.RegularPages
|
||||||
case KindSection:
|
case KindSection:
|
||||||
sectionData, ok := s.Sections[p.sections[0]]
|
sectionData, ok := s.Sections[p.sections[0]]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Reference in New Issue
Block a user