Skip to content

Commit

Permalink
Create posts-pagination.html
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Jan 15, 2015
1 parent f116def commit b397317
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions posts-pagination.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% comment %}
Shows `<span>` elements for non-linked pages and `<a>`s for active links. Automatically accounts for Jekyll's pagination problem where there is no `page1` with a special `if` statement (for when `page == 2`).
{% endcomment %}

<div class="pagination">
{% if paginator.next_page %}
<a class="pagination-item older" href="{{ site.baseurl }}page{{paginator.next_page}}">Older</a>
{% else %}
<span class="pagination-item older">Older</span>
{% endif %}
{% if paginator.previous_page %}
{% if paginator.page == 2 %}
<a class="pagination-item newer" href="{{ site.baseurl }}">Newer</a>
{% else %}
<a class="pagination-item newer" href="{{ site.baseurl }}page{{paginator.previous_page}}">Newer</a>
{% endif %}
{% else %}
<span class="pagination-item newer">Newer</span>
{% endif %}
</div>

0 comments on commit b397317

Please sign in to comment.