Skip to content

Commit

Permalink
Add select maximum number of posts per page (#866)
Browse files Browse the repository at this point in the history
* Add select maximum number of posts per page

* Rename ans simplify posts to show

* Fix
  • Loading branch information
BernatBC authored Jan 19, 2024
1 parent 1aa2792 commit def5ce6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
<div class="content container-fluid" id="content">
<div class="container-fluid post-card-holder" id="post-card-holder">
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }}
{{ $paginator := .Paginate $posts 12 }}
{{ $numShow := site.Params.features.pagination.maxPostsPerPage | default 12}}
{{ $paginator := .Paginate $posts $numShow }}
{{ range $paginator.Pages }}
{{ if .Layout }}
{{/* ignore the search.md file*/}}
Expand Down
3 changes: 2 additions & 1 deletion layouts/categories/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<div class="content container-fluid" id="content">
<div class="container-fluid post-card-holder" id="post-card-holder">
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }}
{{ $paginator := .Paginate $posts 12 }}
{{ $numShow := site.Params.features.pagination.maxPostsPerPage | default 12}}
{{ $paginator := .Paginate $posts $numShow }}
{{ range $paginator.Pages }}
{{ if .Layout }}
{{/* ignore the search.md file*/}}
Expand Down
3 changes: 2 additions & 1 deletion layouts/tags/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<div class="content container-fluid" id="content">
<div class="container-fluid post-card-holder" id="post-card-holder">
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }}
{{ $paginator := .Paginate $posts 12 }}
{{ $numShow := site.Params.features.pagination.maxPostsPerPage | default 12}}
{{ $paginator := .Paginate $posts $numShow }}
{{ range $paginator.Pages }}
{{ if .Layout }}
{{/* ignore the search.md file*/}}
Expand Down

0 comments on commit def5ce6

Please sign in to comment.