about summary refs log tree commit diff
path: root/layouts/partials
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2021-06-08 22:11:32 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2021-06-08 22:11:32 +0700
commita1a5e22cce5da1d3c2df63abc4c284a44dc065b5 (patch)
tree8f938365420f0e8811e00c41cb1779d2e3ea6982 /layouts/partials
parent627994a70827b75dc9e433c218b2305d6b8e6c5a (diff)
downloadblog-a1a5e22cce5da1d3c2df63abc4c284a44dc065b5.tar.gz
Add layout for comics
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/comicNav.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/layouts/partials/comicNav.html b/layouts/partials/comicNav.html
new file mode 100644
index 0000000..2d8eeac
--- /dev/null
+++ b/layouts/partials/comicNav.html
@@ -0,0 +1,40 @@
+{{ $comics := ($.Site.GetPage "section" .Section).Pages.ByPublishDate }}
+{{ $random := (shuffle (where (where .Site.RegularPages "Section" "comics") "Title" "!=" .Title )) }}
+
+{{ if (eq .PrevInSection nil) }}
+    <button disabled> First </button>
+    <button disabled> Prev </button>
+{{ end }}
+
+{{ with .PrevInSection }}
+  {{ range first 1 $comics }}
+    <a href="{{ .Permalink }}">
+      <button> First </button>
+    </a>
+  {{ end }}
+  <a href="{{ .Permalink }}">
+    <button> Prev </button>
+  </a>
+{{ end }}
+
+{{ range first 1 $random }}
+<a href="{{.Permalink}}">
+  <button> Random </button>
+</a>
+{{ end }}
+
+{{ with .NextInSection }}
+  <a href="{{ .Permalink }}">
+    <button> Next </button>
+  </a>
+
+  {{ range last 1 $comics }}
+    <a href="{{ .Permalink }}">
+      <button> Last </button>
+    </a>
+  {{ end }}
+{{ end }}
+{{ if (eq .NextInSection nil) }}
+    <button disabled> Next </button>
+    <button disabled> Last </button>
+{{ end }}