From a8a70edb5dceaa7bedd7b7912c758ed1e780993e Mon Sep 17 00:00:00 2001 From: tdro Date: Fri, 26 May 2023 14:16:59 -0400 Subject: themes/default/layouts/partials/navigator-middle: Support limited back tracking Without js --- themes/default/layouts/_default/index.html | 1 - .../default/layouts/partials/navigator-middle.html | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'themes') diff --git a/themes/default/layouts/_default/index.html b/themes/default/layouts/_default/index.html index 37c9855..cc361b6 100644 --- a/themes/default/layouts/_default/index.html +++ b/themes/default/layouts/_default/index.html @@ -10,7 +10,6 @@ {{- partial "navigator-middle.html" (dict "Context" . - "Href" "/" "Icon" "arrow-left" "IconLabel" "Back" "Id" "back" diff --git a/themes/default/layouts/partials/navigator-middle.html b/themes/default/layouts/partials/navigator-middle.html index 6521119..2c72120 100644 --- a/themes/default/layouts/partials/navigator-middle.html +++ b/themes/default/layouts/partials/navigator-middle.html @@ -1,8 +1,15 @@ -{{- $id := .Id -}} {{- $href := .Href -}} +{{- $id := or .Id "top" -}} +{{- $label := title $id -}} {{- $icon := readFile (print (partial "function-paths.html").static "/icons/feather/arrow-up.svg") -}} {{- $refresh := readFile (print (partial "function-paths.html").static "/icons/feather/refresh-cw.svg") -}} -{{- $label := "Top" -}} + +{{- with $paginator := .Context.Paginator -}} + {{- $href = or (and (eq $paginator.PageNumber 1) $href) + (and (gt $paginator.PageNumber 1) ($paginator.Prev.URL | absURL)) + "#" + -}} +{{- end -}} {{- with .Icon -}} {{- $icon = readFile (print (partial "function-paths.html").static "/icons/feather/" . ".svg") -}} @@ -16,8 +23,8 @@ {{ safeHTML $icon }} {{ safeHTML $refresh }} @@ -37,7 +44,7 @@ {{ if .Context.Site.Menus.main }} {{ range .Context.Site.Menus.main }} - {{ with .Identifier }} @@ -70,11 +77,11 @@ {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/search.svg")) }} Search - + - + -- cgit v1.2.3