Make home.Pages work like any other section

Fixes #6240
This commit is contained in:
Bjørn Erik Pedersen 2019-09-02 17:34:02 +02:00
parent 45d7988f2d
commit 4898fb3d64
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 3 additions and 10 deletions

View file

@ -193,7 +193,7 @@ Some **Markdown** in JSON shortcode.
b.AssertFileContent("public/index.html", b.AssertFileContent("public/index.html",
"home|In English", "home|In English",
"Site params: Rules", "Site params: Rules",
"Pages: Pages(18)|Data Pages: Pages(18)", "Pages: Pages(6)|Data Pages: Pages(6)",
"Paginator: 1", "Paginator: 1",
"First Site: In English", "First Site: In English",
"RelPermalink: /", "RelPermalink: /",

View file

@ -146,9 +146,7 @@ func (p *pageState) RegularPages() page.Pages {
switch p.Kind() { switch p.Kind() {
case page.KindPage: case page.KindPage:
case page.KindHome: case page.KindSection, page.KindHome, page.KindTaxonomyTerm:
pages = p.s.RegularPages()
case page.KindSection, page.KindTaxonomyTerm:
pages = p.getPages() pages = p.getPages()
case page.KindTaxonomy: case page.KindTaxonomy:
all := p.Pages() all := p.Pages()
@ -174,12 +172,7 @@ func (p *pageState) Pages() page.Pages {
switch p.Kind() { switch p.Kind() {
case page.KindPage: case page.KindPage:
case page.KindHome: case page.KindSection, 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:
pages = p.getPagesAndSections() pages = p.getPagesAndSections()
case page.KindTaxonomy: case page.KindTaxonomy:
termInfo := p.bucket termInfo := p.bucket