Rework blog posts list
This commit is contained in:
parent
86e1835a47
commit
987c203cfa
1 changed files with 11 additions and 14 deletions
|
@ -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>
|
||||
|
|
Reference in a new issue