Problem with Twig group function, group by year I am trying to apply the group filter so that my year headings appear in DESC order. They are appearing in ASC order instead, and applying |reverse doesn't work. Suggestions?

{% set entries = craft.entries.section('blat')
.orderBy('postDate DESC')
.limit(null)
.with ( ['thumbnail'] )
%}
{% set entriesByYear = entries|group('postDate.year') %}
{% for year, entriesInYear in entriesByYear %}

    &lt;h2&gt;{{ year }}&lt;/h2&gt;

  {% for entry in entriesInYear %}

{% endfor %}
You don't mention where you tried putting the reverse filter, but perhaps you put it in the wrong place? It should go here:

{% set entriesByYear = entries|reverse|group('postDate.year') %}

I've tested this and it works ok for me.