Explorar o código

Sort articles in the related posts section by date in ascending order

I think ascending is better. This way older article will appear on top
of the list. Recent related articles may already appear in recent posts
section. You need to bubble up older articles.
Talha Mansoor %!s(int64=11) %!d(string=hai) anos
pai
achega
bb21f4b13b
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      templates/_includes/related_posts.html

+ 1 - 1
templates/_includes/related_posts.html

@@ -3,7 +3,7 @@
 <section>
     <h2>{{ RELATED_POSTS_LABEL }}</h2>
 <ul class="related-posts-list">
-{% for related_post in article.related_posts %}
+{% for related_post in article.related_posts|sort(attribute = 'date') %}
     {% set title = related_post.title|striptags %}
     {% set htitle = title %}
     {%if related_post.subtitle %}