Skip to content

Instantly share code, notes, and snippets.

@level09
Created February 23, 2016 20:10
Show Gist options
  • Save level09/fbca587c7f6be097424b to your computer and use it in GitHub Desktop.
Save level09/fbca587c7f6be097424b to your computer and use it in GitHub Desktop.
{% macro render_pagination(pagination) %}
<nav class="pagination">
{% if pagination.has_prev %}
<a class="prev" href="{{ url_for_other_page(pagination.page -1)}}">
< Previous
</a>
{% endif %}
{%- for page in pagination.iter_pages() %}
{% if page %}
{% if page != pagination.page %}
<a href="{{ url_for_other_page(page) }}">{{ page }}</a></li>
{% else %}
<a>{{ page }}</a></li>
{% endif %}
{% else %}
<span class=ellipsis>…</span>
{% endif %}
{%- endfor %}
{% if pagination.has_next %}
<a class="next" href="{{ url_for_other_page(pagination.page + 1)}}">
Next >
</a>
{% endif %}
</nav>
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment