oliverdavies.uk/source/_partials/post-pager.html.twig

42 lines
1.8 KiB
Twig
Raw Normal View History

2018-06-03 11:05:03 +00:00
<div class="py-8 text-center">
<ul class="list-reset inline-flex">
<li>
{% if page.pagination.page == 1 %}
2019-03-21 09:38:09 +00:00
<span class="rounded-l-lg p-3 border border-gray text-gray -mr-px cursor-not-allowed">
2018-06-03 11:05:03 +00:00
Previous
</span>
{% else %}
2019-03-21 09:38:09 +00:00
<a href="{{ page.pagination.previous_page.url }}" class="rounded-l-lg link no-underline hover:underline hover:bg-gray-200 focus:underline p-3 border border-gray -mr-px">
2018-06-03 11:05:03 +00:00
Previous
</a>
{% endif %}
</li>
{% for i in range(1, page.pagination.total_pages) %}
2018-06-21 05:58:48 +00:00
<li class="{{ i > (page.pagination.page + 2) or i < (page.pagination.page - 2) ? 'hidden sm:block' }}">
2018-06-03 11:05:03 +00:00
{% if i == page.pagination.page %}
2019-03-21 09:38:09 +00:00
<span class="p-3 border border-gray text-white bg-blue-600 -mr-px">
2018-06-03 11:05:03 +00:00
{{ i }}
</span>
{% else %}
2019-03-21 09:38:09 +00:00
<a href="{{ i == 1 ? '/blog' : '/blog/page/' ~ i ~ '.html' }}" class="link no-underline hover:underline hover:bg-gray-200 focus:underline p-3 border border-gray -mr-px">
2018-06-03 11:05:03 +00:00
{{ i }}
</a>
{% endif %}
</li>
{% endfor %}
<li>
{% if page.pagination.next_page.url %}
2019-03-21 09:38:09 +00:00
<a href="{{ page.pagination.next_page.url }}" class="rounded-r-lg link no-underline hover:underline hover:bg-gray-200 focus:underline p-3 border border-gray">
2018-06-03 11:05:03 +00:00
Next
</a>
{% else %}
2019-03-21 09:38:09 +00:00
<span class="rounded-r-lg p-3 border border-gray text-gray cursor-not-allowed">
2018-06-03 11:05:03 +00:00
Next
</span>
{% endif %}
</li>
</ul>
</div>