about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--layouts/_default/single.html17
-rw-r--r--layouts/partials/comicNav.html40
2 files changed, 54 insertions, 3 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index b3783eb..2c87ed3 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -12,10 +12,21 @@
 		<h1 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}">{{ trim .Title  " " }}</h1>
 	</header>
 	<div class="content e-content">
+		<!-- Comics-->
+		{{ if in .Params.categories "comics" }}
+		<center>
+		{{ partial "comicNav.html" . }}
 		{{ .Content }}
-		{{ if in .Params.categories "book review" }}
-		<hr>
-		{{ i18n "BookShare" }}
+		{{ partial "comicNav.html" . }}
+		<center>
+		{{ else }}
+		<!-- normal content -->
+		{{ .Content }}
+			<!-- book reviews -->
+			{{ if in .Params.categories "book review" }}
+			<hr>
+			{{ i18n "BookShare" }}
+			{{ end }}
 		{{ end }}
 	</div>
 	{{ partial "postInfo.html" . }}
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 }}