aboutsummaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-05-26 14:16:59 -0400
committertdro <tdro@noreply.example.com>2023-05-26 14:22:25 -0400
commita8a70edb5dceaa7bedd7b7912c758ed1e780993e (patch)
treefdb473334079b805c0f5a795d2da033cee50977f /themes
parent2fe4908fd4cec1db8108d98dbca983e741d081e8 (diff)
downloadcanory-a8a70edb5dceaa7bedd7b7912c758ed1e780993e.tar.gz
canory-a8a70edb5dceaa7bedd7b7912c758ed1e780993e.tar.bz2
canory-a8a70edb5dceaa7bedd7b7912c758ed1e780993e.zip
themes/default/layouts/partials/navigator-middle: Support limited back tracking
Without js
Diffstat (limited to 'themes')
-rw-r--r--themes/default/layouts/_default/index.html1
-rw-r--r--themes/default/layouts/partials/navigator-middle.html21
2 files changed, 14 insertions, 8 deletions
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 @@
<icon-button>
<a
data-update=""
- id="{{ or $id "top" }}"
- href="{{ or $href "#" }}"
+ id="{{ $id }}"
+ href="{{ $href }}"
>
{{ safeHTML $icon }}
{{ safeHTML $refresh }}
@@ -37,7 +44,7 @@
{{ if .Context.Site.Menus.main }}
{{ range .Context.Site.Menus.main }}
- <icon-navigator hidden>
+ <icon-navigator hidden="">
<icon-button>
<a id="nav-middle-{{ path.Base .Identifier }}" href="{{ .URL | absURL }}">
{{ with .Identifier }}
@@ -70,11 +77,11 @@
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/search.svg")) }}
<small>Search</small>
</button>
- <ul hidden id="search-results"></ul>
+ <ul hidden="" id="search-results"></ul>
</form>
</search-entry>
</nav>
<navigation-separator>
- <hr hidden />
+ <hr hidden="" />
</navigation-separator>