commit 79166cdd6819833c4bd4059ab4004c3443d21278 parent 7b4af097be33f85930cf2ee32aa66f240a3144df Author: Mark Wilkerson <mark@markwilkerson.me> Date: Mon, 21 Dec 2020 23:40:14 -0800 add pagination Diffstat:
M | assets/sass/main.sass | | | 17 | +++++++++++++++++ |
A | layouts/_default/index.html | | | 27 | +++++++++++++++++++++++++++ |
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/assets/sass/main.sass b/assets/sass/main.sass @@ -109,3 +109,20 @@ figure.hero max-width: 640px figcaption font-size: 0.5em + +nav.pagination + margin: 2em auto + text-align: center + +.pagination + ul, li + list-style: none + display: inline + li + padding: 0.5em + a + text-decoration: none + color: black + li.active + a + font-weight: bold diff --git a/layouts/_default/index.html b/layouts/_default/index.html @@ -0,0 +1,27 @@ +{{ define "content" }} +<main class="main"> + <ul class="h-feed"> + {{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }} + {{ range $paginator.Pages }} + <li class="h-entry"> + <h2 class="p-name"><a href="{{ .Permalink }}" class="u-url">{{ .Title }}</a></h2> + <time class="dt-published" datetime="{{ .Date.Format `Jan 02 2006` }}">{{ .Date.Format "Jan 02, 2006" }}</time> + + <article class="p-summary"> + {{ .Summary }} + {{ if .Truncated }} + <p><a href="{{ .RelPermalink }}">Read Moreā¦</a></p> + {{ end }} + </article> + </li> + {{ end }} + </ul> + + <nav class="pagination"> + page: + {{ template "_internal/pagination.html" . }} + </nav> + +</main> +{{ end }} +