aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/data/themes/base-jinja/templates/pagination_helper.tmpl
blob: 73cf699d94f57f4d3de11eba7c112fa89a102440 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{#  -*- coding: utf-8 -*- #}
{% macro page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed, surrounding=5) %}
<div class="page-navigation">
  {% for i, link in enumerate(page_links) %}
    {% if (i - current_page)|abs <= surrounding or i == 0 or i == page_links|length - 1 %}
      {% if i == current_page %}
        <span class="current-page">{{ i+1 }}</span>
      {% else %}
        <a href="{{ page_links[i] }}">{{ i+1 }}</a>
      {% endif %}
    {% elif i == current_page - surrounding - 1 or i == current_page + surrounding + 1 %}
      <span class="ellipsis">…</span>
    {% endif %}
  {% endfor %}
</div>
{% endmacro %}