shithub: hugo

Download patch

ref: 08e4f9ff9cc448d5fea9b8a62a23aed8aad0d047
parent: acfa153863d6ff2acf17ffb4395e05d102229905
author: Cameron Moore <moorereason@gmail.com>
date: Thu Oct 15 16:13:41 EDT 2020

embedded: Always show page number when 5 pages or less

Fixes #7523

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