Created
August 21, 2012 19:18
-
-
Save vassilis/3418476 to your computer and use it in GitHub Desktop.
Octopress Pagination
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 paginator.total_pages > 1 %} | |
<div class="pagination"> | |
{% if paginator.previous_page %} | |
<a class="prev" href="{{paginator.previous_page}}">← Prev</a> | |
{% endif %} | |
{% for page in (1..paginator.total_pages) %} | |
{% capture url %}/{{site.pagination_dir}}/page/{{page}}{% endcapture %} | |
{% if page == 1 %} | |
{% assign url = "/" %} | |
{% endif %} | |
{% if page != paginator.page %} | |
<a href="{{url}}">{{page}}</a> | |
{% else %} | |
<span>{{page}}</span> | |
{% endif %} | |
{% endfor %} | |
{% if paginator.next_page %} | |
<a class="next" href="{{paginator.next_page}}">Next →</a> | |
{% endif %} | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment