From 97721a3c49c8ec690c2223dc55d7d6ab3d051a0f Mon Sep 17 00:00:00 2001 From: BernatBC Date: Fri, 19 Jan 2024 10:12:58 +0100 Subject: [PATCH] Add select maximum number of posts per page --- layouts/_default/list.html | 6 +++++- layouts/categories/list.html | 6 +++++- layouts/tags/list.html | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 6bc2de4..b6937cd 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -32,7 +32,11 @@
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }} - {{ $paginator := .Paginate $posts 12 }} + {{ $numShow := 12}} + {{ if site.Params.postsPage.maxPostsPerPage}} + {{ $numShow = site.Params.postsPage.maxPostsPerPage }} + {{ end }} + {{ $paginator := .Paginate $posts $numShow }} {{ range $paginator.Pages }} {{ if .Layout }} {{/* ignore the search.md file*/}} diff --git a/layouts/categories/list.html b/layouts/categories/list.html index 48a48a4..afc31ac 100644 --- a/layouts/categories/list.html +++ b/layouts/categories/list.html @@ -33,7 +33,11 @@
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }} - {{ $paginator := .Paginate $posts 12 }} + {{ $numShow := 12}} + {{ if site.Params.postsPage.maxPostsPerPage}} + {{ $numShow = site.Params.postsPage.maxPostsPerPage }} + {{ end }} + {{ $paginator := .Paginate $posts $numShow }} {{ range $paginator.Pages }} {{ if .Layout }} {{/* ignore the search.md file*/}} diff --git a/layouts/tags/list.html b/layouts/tags/list.html index 4ff7fd7..76a381a 100644 --- a/layouts/tags/list.html +++ b/layouts/tags/list.html @@ -33,7 +33,11 @@
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }} - {{ $paginator := .Paginate $posts 12 }} + {{ $numShow := 12}} + {{ if site.Params.postsPage.maxPostsPerPage}} + {{ $numShow = site.Params.postsPage.maxPostsPerPage }} + {{ end }} + {{ $paginator := .Paginate $posts $numShow }} {{ range $paginator.Pages }} {{ if .Layout }} {{/* ignore the search.md file*/}}