aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/data/themes/base/templates/pagination_helper.tmpl
blob: 91c11154ac8cee46f07860bab92745ad63297720 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
## -*- coding: utf-8 -*-
<%def name="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 abs(i - current_page) <= surrounding or i == 0 or i == len(page_links) - 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>
</%def>