Rework blog posts list

This commit is contained in:
Gabriel Augendre 2020-12-25 11:44:52 +01:00
parent 86e1835a47
commit 987c203cfa
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4

View file

@ -8,28 +8,25 @@
{% block content %}
<section>
<h2>Blog posts</h2>
<table>
<tr><th scope="col">Date</th><th scope="col">Title</th></tr>
<h2 id="blog-posts">Blog posts</h2>
{% for article in articles %}
<tr>
<td>{% include "articles/snippets/datetime.html" %}</td>
<td><a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a></td>
</tr>
<p>
{% include "articles/snippets/datetime.html" %}<br>
<a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a>
</p>
{% empty %}
<tr><td colspan="2">No article here. Come back later 🙂</td></tr>
<p>No article here. Come back later 🙂</p>
{% endfor %}
</table>
</section>
<nav class="pagination">
<div>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}">⇠ Older</a>
<a href="?page={{ page_obj.next_page_number }}#blog-posts"><button>⇠ Older</button></a>
{% endif %}
</div>
<div>
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}">Newer ⇢</a>
<a href="?page={{ page_obj.previous_page_number }}#blog-posts"><button>Newer ⇢</button></a>
{% endif %}
</div>
</nav>