Add config options page.nextPrevSortOrder/nextPrevInSectionSortOrder

See #12776
This commit is contained in:
Bjørn Erik Pedersen
2024-08-17 15:16:09 +02:00
parent 53c0ddfcb4
commit 01008ba512
6 changed files with 132 additions and 1 deletions

View File

@@ -422,3 +422,18 @@ type Pagination struct {
// Whether to disable generation of alias for the first pagination page.
DisableAliases bool
}
// PageConfig configures the behavior of pages.
type PageConfig struct {
// Sort order for Page.Next and Page.Prev. Default "desc" (the default page sort order in Hugo).
NextPrevSortOrder string
// Sort order for Page.NextInSection and Page.PrevInSection. Default "desc".
NextPrevInSectionSortOrder string
}
func (c *PageConfig) CompileConfig(loggers.Logger) error {
c.NextPrevInSectionSortOrder = strings.ToLower(c.NextPrevInSectionSortOrder)
c.NextPrevSortOrder = strings.ToLower(c.NextPrevSortOrder)
return nil
}