Sort articles on tag pages by publication date.

This commit is contained in:
Ethan Dalool 2020-03-23 13:00:41 -07:00
parent 30672d0405
commit 66e6301c32

View file

@ -272,11 +272,11 @@ def maketagpage(index, path):
{% endif %} {% endif %}
</section> </section>
{% if index.articles %} {% if articles %}
<section style="grid-area:articles"> <section style="grid-area:articles">
<h1>{{path}}</h1> <h1>{{path}}</h1>
<ul> <ul>
{% for article in index.articles %} {% for article in articles %}
<li> <li>
<a href="/writing/{{article.web_path}}">{{article.title}}</a> <a href="/writing/{{article.web_path}}">{{article.title}}</a>
</li> </li>
@ -306,6 +306,7 @@ def maketagpage(index, path):
''').render( ''').render(
parent=parent, parent=parent,
index=index, index=index,
articles=sorted(index.articles, key=lambda a: a.date, reverse=True),
path=path, path=path,
children=sorted(tag.name for tag in index.children.keys()), children=sorted(tag.name for tag in index.children.keys()),
) )