Add pagination links

This commit is contained in:
Gabriel Augendre 2020-08-16 20:33:58 +02:00
parent 40cc410369
commit 0632a4ced8
3 changed files with 40 additions and 23 deletions

View file

@ -3,7 +3,6 @@
Simple blog management system. Simple blog management system.
## Todo ## Todo
2. Add pagination links
4. Find a nice way to display metadata (author, dates, etc) 4. Find a nice way to display metadata (author, dates, etc)
5. Allow adding pages (pinned articles ?) 5. Allow adding pages (pinned articles ?)
6. Add syntax coloration to code blocks 6. Add syntax coloration to code blocks

View file

@ -43,6 +43,11 @@ article.article-list h2 a {
text-decoration: none; text-decoration: none;
} }
.pagination {
display: flex;
justify-content: space-between;
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--accent: #226997; --accent: #226997;
@ -57,6 +62,7 @@ article.article-list h2 a {
opacity: .75; opacity: .75;
transition: opacity .5s ease-in-out; transition: opacity .5s ease-in-out;
} }
img:hover { img:hover {
opacity: 1; opacity: 1;
} }

View file

@ -12,4 +12,16 @@
{% empty %} {% empty %}
<p>No article here. Come back later 🙂</p> <p>No article here. Come back later 🙂</p>
{% endfor %} {% endfor %}
<div class="pagination">
<div class="older">
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}">⇠ Older</a>
{% endif %}
</div>
<div class="newer">
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}">Newer ⇢</a>
{% endif %}
</div>
</div>
{% endblock %} {% endblock %}