summaryrefslogtreecommitdiff
path: root/_includes/views/pagination.html
diff options
context:
space:
mode:
authorJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-11 12:19:34 +0800
committerJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-11 12:21:17 +0800
commit61eae5c5f9881cab29712f6e696085baa977e1f9 (patch)
treebb301b58b94fee5dcefbdfae8f0c8fc13ee5bd21 /_includes/views/pagination.html
parentcd3a8163dd997d0a7c4d320816651efa8f7dce60 (diff)
release: v1.0.0
Diffstat (limited to '_includes/views/pagination.html')
-rw-r--r--_includes/views/pagination.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/_includes/views/pagination.html b/_includes/views/pagination.html
new file mode 100644
index 0000000..11eb5aa
--- /dev/null
+++ b/_includes/views/pagination.html
@@ -0,0 +1,33 @@
+{%- if page.paginator -%}
+ {%- assign paginator = page.paginator -%}
+{%- elsif paginator == nil -%}
+ {%- assign paginator = site -%}
+{%- endif -%}
+
+{%- if paginator.posts.size > 0 -%}
+<div class="pagination">
+ <!-- Post list links -->
+ <ul class="post-list">
+ {%- for post in paginator.posts -%}
+ <li>
+ {%- assign date_format = site.yat.date_format | default: "%b %-d, %Y" -%}
+ <span class="post-meta">{{ post.date | date: date_format }}</span>
+ <h3>
+ {%- assign post_url = post.url | relative_url -%}
+ <a class="post-link" href="{{ post_url }}">
+ {{ post.title | escape }}
+ </a>
+ </h3>
+ <p class="post-excerpt">
+ {{ post.content | strip_html | truncatewords: 50 }}
+ </p>
+ </li>
+ {%- endfor -%}
+ </ul>
+
+ <!-- Pagination links -->
+ {%- if paginator.posts.size < site.posts.size -%}
+ {%- include views/paginator.html -%}
+ {%- endif -%}
+</div>
+{%- endif -%}