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 %} {% block content %}
<section> <section>
<h2>Blog posts</h2> <h2 id="blog-posts">Blog posts</h2>
<table>
<tr><th scope="col">Date</th><th scope="col">Title</th></tr>
{% for article in articles %} {% for article in articles %}
<tr> <p>
<td>{% include "articles/snippets/datetime.html" %}</td> {% include "articles/snippets/datetime.html" %}<br>
<td><a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a></td> <a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a>
</tr> </p>
{% empty %} {% empty %}
<tr><td colspan="2">No article here. Come back later 🙂</td></tr> <p>No article here. Come back later 🙂</p>
{% endfor %} {% endfor %}
</table>
</section> </section>
<nav class="pagination"> <nav class="pagination">
<div> <div>
{% if page_obj.has_next %} {% 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 %} {% endif %}
</div> </div>
<div> <div>
{% if page_obj.has_previous %} {% 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 %} {% endif %}
</div> </div>
</nav> </nav>