Created
November 23, 2017 08:28
-
-
Save ChVuagniaux/63b319b70537298c9e6dc067051b9acc to your computer and use it in GitHub Desktop.
OctoberCMS blog pagination that use "/post" instead of "/posts/1"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if posts.lastPage > 1 %} | |
<ul class="pagination"> | |
{% if posts.currentPage > 1 %} | |
{% if (posts.currentPage == 2) %} | |
<li><a href="{{ listPage|page({ (pageParam): null }) }}">← </a></li> | |
{% else %} | |
<li><a href="{{ listPage|page({ (pageParam): (posts.currentPage - 1) }) }}">← </a></li> | |
{% endif %} | |
{% endif %} | |
{% for page in 1..posts.lastPage %} | |
{% if (page == 1) %} | |
<li class="{{ posts.currentPage == page ? 'active' }}"> | |
<a href="{{ listPage|page({ (pageParam): null }) }}">{{ page }}</a> | |
</li> | |
{% else %} | |
<li class="{{ posts.currentPage == page ? 'active' }}"> | |
<a href="{{ listPage|page({ (pageParam): page }) }}">{{ page }}</a> | |
</li> | |
{% endif %} | |
{% endfor %} | |
{% if posts.lastPage > posts.currentPage %} | |
<li><a href="{{ listPage |page({ (pageParam): (posts.currentPage + 1) }) }}"> →</a></li> | |
{% endif %} | |
</ul> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment