aboutsummaryrefslogtreecommitdiffstats
path: root/site/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'site/layouts')
-rw-r--r--site/layouts/_default/list.html3
-rw-r--r--site/layouts/partials/blog.html2
-rw-r--r--site/layouts/partials/pagination.html18
3 files changed, 21 insertions, 2 deletions
diff --git a/site/layouts/_default/list.html b/site/layouts/_default/list.html
index c23fa0c..81ce590 100644
--- a/site/layouts/_default/list.html
+++ b/site/layouts/_default/list.html
@@ -4,12 +4,13 @@
<div class="mw7 center">
<ul class="flex-ns flex-wrap mhn1-ns pa3">
- {{ range .Data.Pages }}
+ {{ range (.Paginator 4).Pages.ByPublishDate }}
<div class="w-50-ns ph1-ns flex">
{{ .Render "li"}}
</div>
{{ end }}
</ul>
+ {{ partial "pagination" . }}
</div>
{{end}} \ No newline at end of file
diff --git a/site/layouts/partials/blog.html b/site/layouts/partials/blog.html
index aaa6f01..ce5c9bc 100644
--- a/site/layouts/partials/blog.html
+++ b/site/layouts/partials/blog.html
@@ -4,7 +4,7 @@
<h2 class="f2 b lh-title mb3">Latest stories</h1>
<div class="w-100 flex-ns mhn1-ns flex-wrap mb3">
- {{ range where .Data.Pages "Type" "post" }}
+ {{ range first 4 (where .Data.Pages "Type" "post") }}
<div class="ph1-ns w-50-ns flex">
{{ .Render "li" }}
</div>
diff --git a/site/layouts/partials/pagination.html b/site/layouts/partials/pagination.html
new file mode 100644
index 0000000..b71fc58
--- /dev/null
+++ b/site/layouts/partials/pagination.html
@@ -0,0 +1,18 @@
+{{ if gt .Paginator.TotalPages 1 }}
+
+<nav class="cf pa3">
+ {{ if .Paginator.HasNext }}
+ <a class="fl dib link dim black f6 f5-ns b pa2" title="Next Page" href="{{ .Paginator.Next.URL }}">
+ &larr; Previous
+ </a>
+ {{ end }}
+ <div class="pagination">
+ {{ if .Paginator.HasPrev }}
+ <a class="fl dib link dim black f6 f5-ns b pa2" title="Previous Page" href="{{ .Paginator.Prev.URL }}">
+ Next &rarr;
+ </a>
+ {{ end }}
+ </div>
+</nav>
+
+{{ end }} \ No newline at end of file