aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/data/themes/bootstrap4-jinja/templates/pagination_helper.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'nikola/data/themes/bootstrap4-jinja/templates/pagination_helper.tmpl')
-rw-r--r--nikola/data/themes/bootstrap4-jinja/templates/pagination_helper.tmpl40
1 files changed, 40 insertions, 0 deletions
diff --git a/nikola/data/themes/bootstrap4-jinja/templates/pagination_helper.tmpl b/nikola/data/themes/bootstrap4-jinja/templates/pagination_helper.tmpl
new file mode 100644
index 0000000..30fe534
--- /dev/null
+++ b/nikola/data/themes/bootstrap4-jinja/templates/pagination_helper.tmpl
@@ -0,0 +1,40 @@
+{# -*- coding: utf-8 -*- #}
+{% macro page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed, surrounding=5) %}
+<nav aria-label="Page navigation">
+ <ul class="pagination">
+ {% if prev_next_links_reversed %}
+ {% if nextlink %}
+ <li class="page-item"><a href="{{ nextlink }}" class="page-link" aria-label="{{ messages("Older posts") }}"><span aria-hidden="true">&laquo;</span></a></li>
+ {% else %}
+ <li class="page-item disabled"><a href="#" class="page-link" aria-label="{{ messages("Older posts") }}"><span aria-hidden="true">&laquo;</span></a></li>
+ {% endif %}
+ {% else %}
+ {% if prevlink %}
+ <li class="page-item"><a href="{{ prevlink }}" class="page-link" aria-label="{{ messages("Newer posts") }}"><span aria-hidden="true">&laquo;</span></a></li>
+ {% else %}
+ <li class="page-item disabled"><a href="#" class="page-link" aria-label="{{ messages("Newer posts") }}"><span aria-hidden="true">&laquo;</span></a></li>
+ {% endif %}
+ {% endif %}
+ {% for i, link in enumerate(page_links) %}
+ {% if (i - current_page)|abs <= surrounding or i == 0 or i == page_links|length - 1 %}
+ <li class="page-item {{ 'active' if i == current_page else '' }}"><a href="{{ link }}" class="page-link">{{ i + 1 }}{{ ' <span class="sr-only">(current)</span>' if i == current_page else '' }}</a></li>
+ {% elif i == current_page - surrounding - 1 or i == current_page + surrounding + 1 %}
+ <li class="page-item disabled"><a href="#" class="page-link" aria-label="…"><span aria-hidden="true">…</span></a></li>
+ {% endif %}
+ {% endfor %}
+ {% if prev_next_links_reversed %}
+ {% if prevlink %}
+ <li class="page-item"><a href="{{ prevlink }}" class="page-link" aria-label="{{ messages("Newer posts") }}"><span aria-hidden="true">&raquo;</span></a></li>
+ {% else %}
+ <li class="page-item disabled"><a href="#" class="page-link" aria-label="{{ messages("Newer posts") }}"><span aria-hidden="true">&raquo;</span></a></li>
+ {% endif %}
+ {% else %}
+ {% if nextlink %}
+ <li class="page-item"><a href="{{ nextlink }}" class="page-link" aria-label="{{ messages("Older posts") }}"><span aria-hidden="true">&raquo;</span></a></li>
+ {% else %}
+ <li class="page-item disabled"><a href="#" class="page-link" aria-label="{{ messages("Older posts") }}"><span aria-hidden="true">&raquo;</span></a></li>
+ {% endif %}
+ {% endif %}
+ </ul>
+</nav>
+{% endmacro %}