shithub: hugo

Download patch

ref: 2fa851e6500752c0cea1da5cfdfc6d99e0a81a71
parent: 21dbfa1f111ca2f066e06af68f267932ce6cf04f
author: Joe Mooring <joe.mooring@veriphor.com>
date: Fri Jul 31 03:35:22 EDT 2020

Fix ellipsis display logic in pagination template

Closes #7523

--- a/tpl/tplimpl/embedded/templates.autogen.go
+++ b/tpl/tplimpl/embedded/templates.autogen.go
@@ -260,8 +260,7 @@
   {{- $shouldEllipse := false -}}
   {{- range $pag.Pagers -}}
   {{- $right := sub .TotalPages .PageNumber -}}
-  {{- $showNumber := or (le .PageNumber 3) (eq $right 0) -}}
-  {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) -}}
+  {{- $showNumber := or (eq .TotalPages 5) (le .PageNumber 3) (eq $right 0) -}}
   {{- if $showNumber -}}
     {{- $ellipsed = false -}}
     {{- $shouldEllipse = false -}}
--- a/tpl/tplimpl/embedded/templates/pagination.html
+++ b/tpl/tplimpl/embedded/templates/pagination.html
@@ -13,8 +13,7 @@
   {{- $shouldEllipse := false -}}
   {{- range $pag.Pagers -}}
   {{- $right := sub .TotalPages .PageNumber -}}
-  {{- $showNumber := or (le .PageNumber 3) (eq $right 0) -}}
-  {{- $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) -}}
+  {{- $showNumber := or (eq .TotalPages 5) (le .PageNumber 3) (eq $right 0) -}}
   {{- if $showNumber -}}
     {{- $ellipsed = false -}}
     {{- $shouldEllipse = false -}}