diff options
author | Niels Gouman <mail@nielsgouman.nl> | 2020-10-07 20:59:19 +0300 |
---|---|---|
committer | Niels Gouman <mail@nielsgouman.nl> | 2020-10-07 20:59:19 +0300 |
commit | 4a0c922e2281b8947f3c87babeea1bfb51db1e14 (patch) | |
tree | 36a6dd4915e5c6447f3b8cc341d3f6742602d0fe /layouts | |
parent | 56ff314e6f338dc851040636e2735118768ab6b4 (diff) |
Create option to disable pagination, and display all posts in the archive
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.html | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e674a11..e8c3e31 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,7 +1,13 @@ {{ define "main"}} <div id="archive"> <ul class="post-list"> - {{ range (sort .Paginator.Pages "Date" "desc") }} + + {{ $pages := .Paginator.Pages }} + {{ if .Site.Params.showAllPostsArchive }} + {{ $pages = .Pages }} + {{ end }} + + {{ range (sort $pages "Date" "desc") }} {{ $pageYear := (.Date.Format "2006") }} {{ if (ne $pageYear ($.Scratch.Get "year")) }} {{ $.Scratch.Set "year" $pageYear }} @@ -17,6 +23,8 @@ </li> {{ end }} </ul> - {{ partial "pagination.html" . }} + {{ if eq .Site.Params.showAllPostsArchive false }} + {{ partial "pagination.html" . }} + {{ end }} </div> {{ end }}
\ No newline at end of file |