chaoswest.tv/templates/macros/pagination.html

30 lines
995 B
HTML

{%- macro render_pagination(pagination) %}
<div class="pagination">
{% if pagination.has_prev -%}
<a href="{{ pagination.prev|url }}">&laquo; Previous</a>
{% else -%}
<a class="disabled">&laquo; Previous</a>
{% endif -%}
{% for site in range(pagination.pages) -%}
{% if site == 0 -%}
{%- if pagination.page == site + 1 -%}
<a class="disabled">{{ pagination.page }}</a>
{%- else -%}
<a href="{{ './'| url }}">{{ site + 1 }}</a>
{%- endif -%}
{%- else -%}
{%- if pagination.page == site + 1 -%}
<a class="disabled" >{{ pagination.page }}</a>
{%- else -%}
<a href="{{ './'| url }}page/{{ site + 1 }}/">{{ site + 1 }}</a>
{%- endif -%}
{%- endif %}
{% endfor -%}
{% if pagination.has_next -%}
<a href="{{ pagination.next|url }}">Next &raquo;</a>
{%- else -%}
<a class="disabled">Next &raquo;</a>
{%- endif %}
</div>
{% endmacro -%}