shithub: hugo

Download patch

ref: bffc4e12fe6d255e1fb8d28943993afc7e99e010
parent: 12f6a1cdc0aedf4319367af57bda3c94150d6a84
author: Joe Mooring <joe@mooring.com>
date: Wed Aug 5 08:36:48 EDT 2020

Revert "Fix ellipsis display logic in pagination template"

This reverts commit 2fa851e6500752c0cea1da5cfdfc6d99e0a81a71.

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