hugo-ataru

Hugo theme with titleless posts and microformats2 support

git clone git://git.shimmy1996.com/hugo-ataru.git
commit cab9864bbe7e1be90c201d7e216ae4e58b62b1aa
parent b24338c1edea937362c911f1fda99b8e7e68d9ac
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Thu,  9 Apr 2020 07:42:08 -0500

Add pagination

Diffstat:
Mlayouts/_default/list.html | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -3,9 +3,12 @@
   {{ .Content }}
   {{ $pages := .Data.Pages }}
   {{ if .IsHome }}
-  {{ $pages = (first 15 (where .Site.RegularPages "Section" "!=" "")) }}
+  {{ $pages = (where .Site.RegularPages "Section" "!=" "") }}
   {{ end }}
-  {{ range $pages }}
+  {{ $pag := .Paginate $pages 15  }}
+  {{ if $pag.HasPrev }}<a href="{{ $pag.Prev.URL }}">↑</a>{{ else }}↑{{ end }}
+  <span style="float:right">{{ if $pag.HasNext }}<a href="{{ $pag.Next.URL }}">↓</a>{{ else }}↓{{ end }}</span>
+  {{ range $pag.Pages }}
   <hr/>
   <article class="h-entry">
     <header>
@@ -16,5 +19,7 @@
     <div class="p-summary">{{ range (findRE "<p>.*</p>" .Content 1) }}{{ (replaceRE "<.p>" "" .) | safeHTML}}{{ end }}</div>
   </article>
   {{ end }}
+  {{ if $pag.HasPrev }}<a href="{{ $pag.Prev.URL }}">↑</a>{{ else }}↑{{ end }}
+  <span style="float:right">{{ if $pag.HasNext }}<a href="{{ $pag.Next.URL }}">↓</a>{{ else }}↓{{ end }}</span>
 </main>
 {{ end }}