Misc paginator adjustments

* Rewind paginator for server mode
* Add some more related tests.
* Replace the clumsy scratch constructs in internal paginator template with variables

See #5825
This commit is contained in:
Bjørn Erik Pedersen
2019-04-07 21:59:37 +02:00
parent 3db4a1cf7a
commit 612a06f067
5 changed files with 121 additions and 13 deletions

View File

@@ -172,7 +172,11 @@ func (s *Site) renderPaginator(p *pageState, layouts []string) error {
d.Type = f
// Rewind
p.paginator.current = p.paginator.current.First()
p.paginator.rewind()
defer func() {
// Prepare for any re-rendering in server mode.
p.paginator.rewind()
}()
// Write alias for page 1
d.Addends = fmt.Sprintf("/%s/%d", paginatePath, 1)