From 967d8ae4e6fcd229bc3c76e012118b48a978f0dd Mon Sep 17 00:00:00 2001 From: Alexandre Vicenzi Date: Mon, 25 May 2020 22:34:28 +0200 Subject: Add pagination --- layouts/index.html | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) (limited to 'layouts') diff --git a/layouts/index.html b/layouts/index.html index 28e95ae..3de3e62 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,29 +1,36 @@ {{ define "main" -}} -
- {{ range .Site.RegularPages -}} - {{ if and (or (eq .Type "post") (eq .Type "article")) (or (not (isset .Params "Hidden")) (eq .Params.Hidden false)) -}} -
-

- {{ .Title }} -

+
+ {{- $regularPages := where .Site.RegularPages "Type" "in" .Site.Params.MainSections -}} + {{- $pagesNotHidden := where $regularPages ".Params.hidden" "==" false -}} + {{- $pagesHiddenUnset := where $regularPages ".Params.hidden" "==" nil -}} - + {{- $pages := $pagesNotHidden | union $pagesHiddenUnset -}} + {{- $paginator := .Paginate $pages -}} - {{ if .Description }} - {{ .Description }} - {{ else }} - {{ .Summary }} - {{ end }} + {{ range $paginator.Pages }} + + + + {{ if .Description }} + {{ .Description }} + {{ else }} + {{ .Summary }} + {{ end }} + + {{ if .Truncated }} + + {{ end }} +
{{- end }} - {{- end }} -
+ + + {{ template "_internal/pagination.html" . }} {{- end }} -- cgit v1.2.1