From 2fb41a96097f335b3e5dbeb8dd0a2ad67bde2d3f Mon Sep 17 00:00:00 2001 From: tdro Date: Mon, 19 Dec 2022 22:01:22 -0500 Subject: themes/default/layouts/partials/pagination: Newer/Older Label Simplify and flex wrap. --- assets/css/default.css | 8 +- themes/default/layouts/partials/pagination.html | 116 +++++++++++------------- 2 files changed, 59 insertions(+), 65 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 11a762c..cfd58c9 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -1418,15 +1418,15 @@ code-block header language-label a:hover { } paginator-navigation { - padding: 1rem 1rem 0 1rem; + padding: 1rem 0.25rem 0 0.25rem; display: flex; align-items: center; justify-content: center; + flex-wrap: wrap; } -paginator-navigation a, -paginator-navigation button { - margin: 0 0.25rem; +paginator-navigation a { + margin: 0 0.25rem 0.5rem 0.25rem; font-size: 85%; display: flex; align-items: center; diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html index 4c2d97f..31bebeb 100644 --- a/themes/default/layouts/partials/pagination.html +++ b/themes/default/layouts/partials/pagination.html @@ -1,73 +1,67 @@ {{- with .Paginator -}} + + {{- $first := "Newest" -}} + {{- $prev := "Newer" -}} + {{- $next := "Older" -}} + {{- $last := "Oldest" -}} + {{- $invisible := "data-invisible" -}} + + {{- $firstData := $invisible -}} + {{- $firstHref := "" -}} + {{- $firstTitle := $first -}} + + {{- if and .HasPrev .First -}} + {{- $firstData = "" -}} + {{- $firstHref = .First.URL -}} + {{- end -}} + + {{- $prevData := $invisible -}} + {{- $prevHref := "" -}} + {{- $prevRel := "prev" -}} + {{- $prevTitle := $prev -}} + + {{- with .Prev -}} + {{- $prevData = "" -}} + {{- $prevHref = .URL -}} + {{- end -}} + + {{- $nextData := $invisible -}} + {{- $nextHref := "" -}} + {{- $nextRel := "next" -}} + {{- $nextTitle := $next -}} + + {{- if .Next -}} + {{- $nextData = "" -}} + {{- $nextHref = .Next.URL -}} + {{- end -}} + + {{- $lastData := $invisible -}} + {{- $lastHref := "" -}} + {{- $lastTitle := $last -}} + + {{- if and .HasNext .Last -}} + {{- $lastData = "" -}} + {{- $lastHref = .Last.URL -}} + {{- end -}} +