chaoswest.tv/templates/macros/pagination.html

30 lines
995 B
HTML
Raw Normal View History

2022-01-20 23:51:09 +01:00
{%- 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 -%}