Add option to not generate aliases for first page of pagination pages

Also consolidate the pagination configuration into a struct.

Closes #12572
This commit is contained in:
Bjørn Erik Pedersen
2024-06-07 17:38:33 +02:00
parent 1cdd3d0a9e
commit 9c4e14eb4f
9 changed files with 135 additions and 14 deletions

View File

@@ -223,7 +223,7 @@ func (s *Site) logMissingLayout(name, layout, kind, outputFormat string) {
// renderPaginator must be run after the owning Page has been rendered.
func (s *Site) renderPaginator(p *pageState, templ tpl.Template) error {
paginatePath := s.conf.PaginatePath
paginatePath := s.Conf.Pagination().Path
d := p.targetPathDescriptor
f := p.s.rc.Format
@@ -233,7 +233,7 @@ func (s *Site) renderPaginator(p *pageState, templ tpl.Template) error {
panic(fmt.Sprintf("invalid paginator state for %q", p.pathOrTitle()))
}
if f.IsHTML {
if f.IsHTML && !s.Conf.Pagination().DisableAliases {
// Write alias for page 1
d.Addends = fmt.Sprintf("/%s/%d", paginatePath, 1)
targetPaths := page.CreateTargetPaths(d)