Created
June 13, 2012 08:31
-
-
Save fizzwu/2922801 to your computer and use it in GitHub Desktop.
pagination in jekyll
This file contains hidden or 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
# other config.. | |
paginate: 10 |
This file contains hidden or 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
{% for post in paginator.posts %} | |
<div class="page"> | |
<h2 class="title"> | |
<a href="{{ post.url }}">{{ post.title }}</a> | |
</h2> | |
<div class="info"> | |
<span>Posted at {{ post.date | date_to_string }}</span> | |
</div> | |
{{ post.content }} | |
{% for tag in post.tags %} | |
<a class="tag" href="/tags.html/#{{ tag }}-ref">{{ tag }}</a> | |
{% endfor %} | |
</div> | |
{% endfor %} | |
<div class="pagination"> | |
<span class="next"> | |
{% if paginator.next_page %} | |
<a href="/page{{ paginator.next_page }}">← Previous</a> | |
{% endif %} | |
</span> | |
<span class="previous"> | |
{% if paginator.previous_page %} | |
{% if paginator.previous_page == 1 %} | |
<a href="/">Next →</a> | |
{% else %} | |
<a href="/page{{ paginator.previous_page }}">Next →</a> | |
{% endif %} | |
{% endif %} | |
</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment