diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-08-17 15:16:09 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-08-17 16:47:50 +0200 |
commit | 01008ba51259e68191b14f8a4725d6116c0c2466 (patch) | |
tree | 4471fb47f602d49b26c51b9c5a1d97dd4f9758cc /hugolib | |
parent | 53c0ddfcb4ec2f4d021f6f51c04f0ba9db741b20 (diff) | |
download | hugo-01008ba51259e68191b14f8a4725d6116c0c2466.tar.gz hugo-01008ba51259e68191b14f8a4725d6116c0c2466.zip |
Add config options page.nextPrevSortOrder/nextPrevInSectionSortOrder
See #12776
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/site.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hugolib/site.go b/hugolib/site.go index bbf110d1d..a93bbdbe6 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -117,6 +117,9 @@ func (s *Site) prepareInits() { s.init.prevNext = init.Branch(func(context.Context) (any, error) { regularPages := s.RegularPages() + if s.conf.Page.NextPrevSortOrder == "asc" { + regularPages = regularPages.Reverse() + } for i, p := range regularPages { np, ok := p.(nextPrevProvider) if !ok { @@ -181,7 +184,11 @@ func (s *Site) prepareInits() { ) for _, section := range sections { - setNextPrev(section.RegularPages()) + ps := section.RegularPages() + if s.conf.Page.NextPrevInSectionSortOrder == "asc" { + ps = ps.Reverse() + } + setNextPrev(ps) } return nil, nil |