From b0b39768de6564e21f28c96fca34e01fa4602116 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 8 Apr 2021 21:48:53 +0300 Subject: _includes: move paginator.html to posts --- _includes/posts/paginator.html | 36 ++++++++++++++++++++++++++++++++++++ _includes/posts/posts.html | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 _includes/posts/paginator.html (limited to '_includes/posts') diff --git a/_includes/posts/paginator.html b/_includes/posts/paginator.html new file mode 100644 index 0000000..471383c --- /dev/null +++ b/_includes/posts/paginator.html @@ -0,0 +1,36 @@ +{% comment %} + Page links, inspired by the example at the bottom of + https://jekyllrb.com/docs/pagination/. +{% endcomment %} +{% if site.posts.size != 0 %} + {% comment %} + Link to page 1 is tricky. If site.paginate_path is used, then we cannot + simply use /. This is a silly attempt to get the proper page 1 link. + {% endcomment %} + {% if paginator.page == 1 %} + {% assign page1_url = page.url %} + {% else %} + {% assign page1_url = page.url | split: '/' | pop | join: '/' | append: '/' %} + {% endif %} + +{% endif %} diff --git a/_includes/posts/posts.html b/_includes/posts/posts.html index 4f52efc..724edc6 100644 --- a/_includes/posts/posts.html +++ b/_includes/posts/posts.html @@ -12,6 +12,6 @@
{% endfor %}
- {% include common/paginator.html %} + {% include posts/paginator.html %}
{% endif %} -- cgit v1.2.3