1

I'm trying to sort recent articles on a particular folder on Freshdesk.

As far as I can tell the article has a "created_on" property that is of 'date/time' type (see "article.created_on" https://support.freshdesk.com/support/solutions/articles/65047-access-to-solutions )

{% assign sorted_articles = (folder.articles | sort: created_on) | reverse %}
{% for article in sorted_articles limit:10 %}
    <li>{{article.id}} - {{article.created_on}} - {{article.title}}</li>
{% endfor %}

For some reason I cannot get it to sort properly, not even by id, or by using the reverse filter, it always returns the same list.

Does anyone see what am I doing wrong on the code above?

Dunnow
  • 414
  • 1
  • 5
  • 22

1 Answers1

1

Regular brackets like that shouldn't be used in a liquid variable so this may be the reason that the order is not changing.

Also, have you tried using the created_at attribute instead of created_on?

For example:

{% assign sorted_articles = folder.articles | sort: created_at | reverse %}

David Mc
  • 109
  • 1
  • 6