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> {% for article in articles %}
<tr><th scope="col">Date</th><th scope="col">Title</th></tr> <p>
{% for article in articles %} {% include "articles/snippets/datetime.html" %}<br>
<tr> <a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a>
<td>{% include "articles/snippets/datetime.html" %}</td> </p>
<td><a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a></td> {% empty %}
</tr> <p>No article here. Come back later 🙂</p>
{% empty %} {% endfor %}
<tr><td colspan="2">No article here. Come back later 🙂</td></tr>
{% 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>