completed pagination

This commit is contained in:
2023-08-13 01:42:45 +03:00
parent 3a8682e8ee
commit dfecd6c7eb
9 changed files with 87 additions and 40 deletions
+2
View File
@@ -1,5 +1,6 @@
{% extends "section.html" %}
{% import "post_macros.html" as page_macros %}
{% import "paginate.html" as paginate_macro %}
{% block content %}
<main id="content">
<header>
@@ -22,6 +23,7 @@
</ul>
</div>
{% endfor %}
{% if paginator %}{{ paginate_macro::paginate() }}{% endif %}
</main>
{% include "footer.html" %}
{% endblock content %}
+1 -2
View File
@@ -18,5 +18,4 @@
<a href="https://github.com/andwati/andwati.com">Source</a>
⬡
<a href="/rss.xml">Feed</a>
</p>
</footer>
</footer>
+25
View File
@@ -0,0 +1,25 @@
{% macro paginate() %}
{% if paginator %}
<ul class="pagination">
{% if paginator.previous %}
<li class="page-item page-prev">
<a href="{{ paginator.previous }}" class="page-link">← Prev</a>
</li>
{% else %}
<li class="page-item page-prev">
<span class="page-link disabled" aria-disabled="true">← Prev</span>
</li>
{% endif %}
<li class="page-item page-numbers">{{ paginator.current_index }} of {{ paginator.number_pagers }}</li>
{% if paginator.next %}
<li class="page-item page-next">
<a href="{{ paginator.next }}" class="page-link">Next →</a>
</li>
{% else %}
<li class="page-item page-next">
<span class="page-link disabled" aria-disabled="trues">Next →</span>
</li>
{% endif %}
</ul>
{% endif %}
{% endmacro paginate %}
+1 -1
View File
@@ -8,7 +8,7 @@
{%- if page.taxonomies.tags | length > 1 and loop.index != page.taxonomies.tags | length -%},{% endif %}
{% endfor %}
{% endif %}
<div class="accent">☕{{ page.reading_time }} minutes 📝 {{ page.word_count }}</div>
<div class="accent">☕ {{ page.reading_time }} minutes 📝 {{ page.word_count }}</div>
</div>
{% endmacro meta %}
{% macro snippet(page) %}
+7 -4
View File
@@ -1,15 +1,18 @@
{% extends "section.html" %}
{% import "post_macros.html" as post_macros %}
{% import "paginate.html" as paginate_macro %}
{% block content %}
<main id="content">
<header>
<h1>Posts</h1>
</header>
{% for page in paginator.pages %}{{ post_macros::snippet(page=page) }}{% endfor %}
<nav>
{% if paginator.previous %}<a href="{{ paginator.previous }}" class="previous">Previous</a>{% endif %}
{% if paginator.next %}<a href="{{ paginator.next }}" class="next">Next</a>{% endif %}
</nav>
<!--<div class="pagination">
{% if paginator.previous %}<a href="{{ paginator.previous }}" class="page-item previous">Previous</a>{% endif %}
{% if paginator.next %}<a href="{{ paginator.next }}" class="page-item next">Next</a>{% endif %}
</div>
-->
{% if paginator %}{{ paginate_macro::paginate() }}{% endif %}
</main>
{% include "footer.html" %}
{% endblock content %}