Split pagination code

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2022-11-26 00:52:11 +01:00
parent 10b5550ed3
commit 3a59f2cabb
3 changed files with 32 additions and 43 deletions
+30
View File
@@ -0,0 +1,30 @@
{% if paginator.total_pages > 1 %}
{% capture index_page_name %}{{ site.pagination.indexpage }}.{{ site.pagination.extension }}{% endcapture %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="first">
<a href="{{ paginator.first_page_path | absolute_url | remove_first: index_page_name }}" alt="Oldest Entries">&laquo</a>
</li>
<li class="prev">
<a href="{{ paginator.previous_page_path | absolute_url | remove_first: index_page_name }}" alt="Older Entries">&larr;</a>
</li>
{% endif %}
{% if paginator.page_trail %}
{% for trail in paginator.page_trail %}
<li class="page{% if page.url == trail.path %} selected{% endif %}">
<a href="{{ trail.path | absolute_url | remove_first: index_page_name }}">{{ trail.num }}</a>
</li>
{% endfor %}
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | absolute_url | remove_first: index_page_name }}" alt="Newer Entries">&rarr;</a>
</li>
<li class="last">
<a href="{{ paginator.last_page_path | absolute_url | remove_first: index_page_name }}" alt="Newest Entries">&raquo;</a>
</li>
{% endif %}
</ul>
{% endif %}
+1 -29
View File
@@ -11,33 +11,5 @@
{% include article.liquid type=post index=true title=data.title content=content permalink=data.url categories=data.categories tags=data.tags timestamp=data.date %}
{% endfor %}
</div>
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="first">
<a href="{{ paginator.first_page_path | absolute_url }}" alt="Oldest Entries">&laquo</a>
</li>
<li class="prev">
<a href="{{ paginator.previous_page_path | absolute_url }}" alt="Older Entries">&larr;</a>
</li>
{% endif %}
{% if paginator.page_trail %}
{% for trail in paginator.page_trail %}
<li class="page{% if page.url == trail.path %} selected{% endif %}">
<a href="{{ trail.path | absolute_url }}">{{ trail.num }}</a>
</li>
{% endfor %}
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | absolute_url }}" alt="Newer Entries">&rarr;</a>
</li>
<li class="last">
<a href="{{ paginator.last_page_path | absolute_url }}" alt="Newest Entries">&raquo;</a>
</li>
{% endif %}
</ul>
{% endif %}
{% include pagination.liquid %}
{% include page_end.liquid %}
+1 -14
View File
@@ -12,18 +12,5 @@
{% include article.liquid type=post index=true title=data.title content=content permalink=data.url categories=data.categories tags=data.tags timestamp=data.date %}
{% endfor %}
</div>
{% if paginator.total_pages > 1 %}
<ul class="pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | absolute_url }}">&larr; Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | absolute_url }}">Older Posts &rarr;</a>
</li>
{% endif %}
</ul>
{% endif %}
{% include pagination.liquid %}
{% include page_end.liquid %}