Make home.Pages work like any other section
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 2 Sep 2019 15:34:02 +0000 (17:34 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 2 Sep 2019 15:34:02 +0000 (17:34 +0200)
Fixes #6240

hugolib/hugo_smoke_test.go
hugolib/page.go

index 2121738a903477990f4cf80e41a0515b2d37ee02..539e797295a321c68befe1315c7a8abd3ed3c7e1 100644 (file)
@@ -193,7 +193,7 @@ Some **Markdown** in JSON shortcode.
        b.AssertFileContent("public/index.html",
                "home|In English",
                "Site params: Rules",
-               "Pages: Pages(18)|Data Pages: Pages(18)",
+               "Pages: Pages(6)|Data Pages: Pages(6)",
                "Paginator: 1",
                "First Site: In English",
                "RelPermalink: /",
index f08e309d43470593acacb9a784c50c6c7e80e7b6..306ca7b0fbe5de0545eca3ad4e8c88d05c372df4 100644 (file)
@@ -146,9 +146,7 @@ func (p *pageState) RegularPages() page.Pages {
 
                switch p.Kind() {
                case page.KindPage:
-               case page.KindHome:
-                       pages = p.s.RegularPages()
-               case page.KindSection, page.KindTaxonomyTerm:
+               case page.KindSection, page.KindHome, page.KindTaxonomyTerm:
                        pages = p.getPages()
                case page.KindTaxonomy:
                        all := p.Pages()
@@ -174,12 +172,7 @@ func (p *pageState) Pages() page.Pages {
 
                switch p.Kind() {
                case page.KindPage:
-               case page.KindHome:
-                       // See https://github.com/gohugoio/hugo/issues/6238
-                       // Note: When making the change below, also remember RegularPages.
-                       p.s.DistinctWarningLog.Println(`In the next Hugo version (0.58.0) we will change how $home.Pages behaves. If you want to list all regular pages, replace .Pages or .Data.Pages with .Site.RegularPages in your home page template.`)
-                       pages = p.s.RegularPages()
-               case page.KindSection:
+               case page.KindSection, page.KindHome:
                        pages = p.getPagesAndSections()
                case page.KindTaxonomy:
                        termInfo := p.bucket