cribbed pagination from quinnanya.github.io with some amendments for working with Minimal Mistakes, and to disable first and last where appropriate
This commit is contained in:
parent
8d89c2d453
commit
8701676bb6
|
@ -0,0 +1,21 @@
|
||||||
|
{% if paginationNextUrl or paginationPrevUrl %}
|
||||||
|
<hr />
|
||||||
|
<div class="inner-wrapper">
|
||||||
|
<footer class="[ pagination ] [ pad-bottom-900 ]">
|
||||||
|
<nav class="[ pagination__nav ] [ box-flex space-between align-center ]">
|
||||||
|
{% if paginationPrevUrl %}
|
||||||
|
<a href="{{ paginationPrevUrl }}" class="{{ paginationLinkTokens }}" data-direction="backwards">
|
||||||
|
<span>{{ paginationPrevText if paginationPrevText else 'Previous' }}</span>
|
||||||
|
{% include "icons/arrow.svg" %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if paginationNextUrl %}
|
||||||
|
<a href="{{ paginationNextUrl }}" class="{{ paginationLinkTokens }}" data-direction="forwards">
|
||||||
|
<span>{{ paginationNextText if paginationNextText else 'Next' }}</span>
|
||||||
|
{% include "icons/arrow.svg" %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
|
@ -1,5 +1,48 @@
|
||||||
---
|
---
|
||||||
layout: home
|
layout: archive
|
||||||
author_profile: true
|
permalink: "{% if pagination.pageNumber>0 %}page-{{ pagination.pageNumber | plus: 1 }}{% endif %}/index.html"
|
||||||
|
pagination:
|
||||||
|
data: collections.posts
|
||||||
|
size: 7
|
||||||
---
|
---
|
||||||
|
|
||||||
|
{%- for post in pagination.items -%}
|
||||||
|
<h2><a href="{% post_url collections.posts, post.fileSlug %}">{{ post.data.title }}</a></h2>
|
||||||
|
<em>{{ post.data.date | toUTCString}}</em>
|
||||||
|
<p>{{ post.templateContent | description }} <a href="{% post_url collections.posts, post.fileSlug %}"><em>read more</em></a></p>
|
||||||
|
{%- endfor -%}
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="pagination">
|
||||||
|
<li>
|
||||||
|
{% if pagination.href.first and pagination.href.previous %}
|
||||||
|
<a href="{{ pagination.href.first }}" class="pagination">First</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="#" class="pagination disabled">{{ "First" }}</a>
|
||||||
|
{% endif %}
|
||||||
|
<li>
|
||||||
|
{% if pagination.href.previous %}
|
||||||
|
<a href="{{ pagination.href.previous }}" class="pagination">Previous</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="#" class="pagination disabled">{{ ui-text[site.locale].pagination_previous | default: "Previous" }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="#" class="pagination current">Page {{ pagination.pageNumber | plus: 1 }}</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>{% if pagination.href.next %}
|
||||||
|
<a href="{{ pagination.href.next }}" class="pagination">Next</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="#" class="pagination disabled">{{ ui-text[site.locale].pagination_next | default: "Next" }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{% if pagination.href.first and pagination.href.next %}
|
||||||
|
<a href="{{ pagination.href.last }}" class="pagination">Last</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="#" class="pagination disabled">{{ "Last" }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue