Liquid markup sorting the output

Viewed 296

I am trying to display a list of all articles using liquid markup. I've got this code which displays them properly, however I want to be able to sort by the modified date descending (most recent article on top). How can this be accomplished?

I was thinking that perhaps I need to create a new array with all articles in it and then sort that, but I am not sure how to do that. Also note that I want to sort ALL of my articles by date, not just within each folder.

{% for category in portal.solution_categories %}
  {% if category.folders_count > 0 %}
    {% for folder in category.folders %}
      {% for article in folder.articles %}
           <a href="{{ article.url }}">{{ article.title }}</a> - {{ article.modified_on | short_day_with_time }} <br>
      {% endfor %}
    {% endfor %}
  {% endif %}
{% endfor %}

Thanks!

1 Answers
Related