mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Fix 2 Paginator.Pages taxonomy regressions
Fixes #6921 Fixes #6918
This commit is contained in:
parent
a70bbd0696
commit
7ef5a4c83e
2 changed files with 18 additions and 8 deletions
|
@ -82,14 +82,19 @@ func (p *pagePaginator) Paginator(options ...interface{}) (*page.Pager, error) {
|
||||||
pd.Type = p.source.outputFormat()
|
pd.Type = p.source.outputFormat()
|
||||||
|
|
||||||
var pages page.Pages
|
var pages page.Pages
|
||||||
if p.source.IsHome() {
|
|
||||||
|
switch p.source.Kind() {
|
||||||
|
case page.KindHome:
|
||||||
// From Hugo 0.57 we made home.Pages() work like any other
|
// From Hugo 0.57 we made home.Pages() work like any other
|
||||||
// section. To avoid the default paginators for the home page
|
// section. To avoid the default paginators for the home page
|
||||||
// changing in the wild, we make this a special case.
|
// changing in the wild, we make this a special case.
|
||||||
pages = p.source.s.RegularPages()
|
pages = p.source.s.RegularPages()
|
||||||
} else {
|
case page.KindTaxonomy, page.KindTaxonomyTerm:
|
||||||
|
pages = p.source.Pages()
|
||||||
|
default:
|
||||||
pages = p.source.RegularPages()
|
pages = p.source.RegularPages()
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator, err := page.Paginate(pd, pages, pagerSize)
|
paginator, err := page.Paginate(pd, pages, pagerSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
initErr = err
|
initErr = err
|
||||||
|
|
|
@ -577,6 +577,9 @@ Cats Pages: {{ range $cats.Pages}}{{.RelPermalink }}|{{ end }}:END
|
||||||
P1 Terms: {{ range $p1.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:END
|
P1 Terms: {{ range $p1.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:END
|
||||||
Section Terms: {{ range $section.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:END
|
Section Terms: {{ range $section.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:END
|
||||||
Home Terms: {{ range $home.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:END
|
Home Terms: {{ range $home.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:END
|
||||||
|
Category Paginator {{ range $categories.Paginator.Pages }}{{ .RelPermalink }}|{{ end }}:END
|
||||||
|
Cats Paginator {{ range $cats.Paginator.Pages }}{{ .RelPermalink }}|{{ end }}:END
|
||||||
|
|
||||||
`)
|
`)
|
||||||
|
|
||||||
b.Build(BuildCfg{})
|
b.Build(BuildCfg{})
|
||||||
|
@ -597,6 +600,8 @@ Home Terms: {{ range $home.GetTerms "categories" }}{{.RelPermalink }}|{{ end }}:
|
||||||
P1 Terms: /categories/cats/|/categories/funny/|:END
|
P1 Terms: /categories/cats/|/categories/funny/|:END
|
||||||
Section Terms: /categories/birds/|/categories/cats/|/categories/dogs/|:END
|
Section Terms: /categories/birds/|/categories/cats/|/categories/dogs/|:END
|
||||||
Home Terms: /categories/dogs/|/categories/gorillas/|:END
|
Home Terms: /categories/dogs/|/categories/gorillas/|:END
|
||||||
|
Cats Paginator /section/p1/|/section/|:END
|
||||||
|
Category Paginator /categories/birds/|/categories/cats/|/categories/dogs/|/categories/funny/|/categories/gorillas/|:END
|
||||||
`)
|
`)
|
||||||
|
|
||||||
b.AssertFileContent("public/categories/funny/index.xml", `<link>http://example.com/section/p1/</link>`)
|
b.AssertFileContent("public/categories/funny/index.xml", `<link>http://example.com/section/p1/</link>`)
|
||||||
|
|
Loading…
Reference in a new issue