This repository has been archived on 2023-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
python-blog/articles/templates/articles/article_list.html

44 lines
1.3 KiB
HTML

{% extends 'articles/base.html' %}
{% block append_header %}
<style>
{{ article.custom_css }}
</style>
{% endblock %}
{% block title %}{% endblock %}
{% block content %}
<section>
<h2 id="blog-posts">Blog posts</h2>
{% for article in articles %}
<p>
{% include "articles/snippets/datetime.html" %}<br>
<a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a>
</p>
{% empty %}
<p>No article here. Come back later 🙂</p>
{% endfor %}
</section>
<nav class="pagination">
<div>
{% if page_obj.has_next %}
<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 }}#blog-posts"><button>Newer ⇢</button></a>
{% endif %}
</div>
</nav>
{% if article %}
<section>
<h2>{{ article.title }}{% include "articles/snippets/admin_link.html" %}</h2>
<div>
{{ article.get_formatted_content|safe }}
</div>
</section>
{% endif %}
{% endblock %}