Skip to content

Instantly share code, notes, and snippets.

@fizzwu
Created June 13, 2012 08:31
Show Gist options
  • Save fizzwu/2922801 to your computer and use it in GitHub Desktop.
Save fizzwu/2922801 to your computer and use it in GitHub Desktop.
pagination in jekyll
# other config..
paginate: 10
{% 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 }}">&larr; Previous</a>
{% endif %}
</span>
<span class="previous">
{% if paginator.previous_page %}
{% if paginator.previous_page == 1 %}
<a href="/">Next &rarr;</a>
{% else %}
<a href="/page{{ paginator.previous_page }}">Next &rarr;</a>
{% endif %}
{% endif %}
</span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment