瀏覽代碼

Add select maximum number of posts per page (#866)

* Add select maximum number of posts per page

* Rename ans simplify posts to show

* Fix
Bernat Borràs Civil 1 年之前
父節點
當前提交
def5ce662e
共有 3 個文件被更改,包括 6 次插入3 次删除
  1. 2 1
      layouts/_default/list.html
  2. 2 1
      layouts/categories/list.html
  3. 2 1
      layouts/tags/list.html

+ 2 - 1
layouts/_default/list.html

@@ -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*/}}

+ 2 - 1
layouts/categories/list.html

@@ -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*/}}

+ 2 - 1
layouts/tags/list.html

@@ -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*/}}