<p>Assuming the <em>years</em> are currently rendered in the correct (descending) order, an easy way to make sure the entries are rendered in ascending order would be to simply <a href="https://twig.symfony.com/doc/2.x/filters/reverse.html" rel="nofollow noreferrer"><code>reverse</code></a> the <code>entriesInYear</code> array, i.e.:</p>

<pre><code>...

{% for entry in entriesInYear|reverse %}
    ...
{% endfor %}
</code></pre>

CC BY-SA 4.0
2018-07-24T18:48:11.430Z
Jop, that works. I knew it’s gonna be an easy solution. :) Thanks a lot for the fast help!
user2190590
CC BY-SA 4.0
2018-07-24T17:54:55.163Z
2018-07-24T17:54:55.163Z
Mats Mikkel Rummelhoff
<p>I have an archive of exhibitions with entries grouped by year. The order of the groups should be descending, the order of the entries within the group should be ascending.</p>

<p>For example: The order of the years should be 2018, 2017, 2016, …
The entries within the group 2018 should start with the first exhibition of the year and end with the last one.</p>

<p>Here is my code:</p>

<pre><code>{% set archive = craft.entries.section("exhibitions").order('dateStart desc').dateEnd('&lt;' ~ now).limit(null)  %}
{% set archiveGrouped = archive|group('dateStart.year') %}
{% for year, entriesInYear in archiveGrouped %}
&lt;div&gt;
    &lt;h2 class="year"&gt;{{ year }}&lt;/h2&gt;
    {% for entry in entriesInYear %}
    &lt;div&gt;
</code></pre>

<p>And the link to the Website: <a href="https://kunsthausbaselland.ch/en/ausstellungen" rel="nofollow noreferrer">https://kunsthausbaselland.ch/en/ausstellungen</a></p>

<p>I guess there is an easy solution for this. But I couldn’t figure it out and found nothing in the docs.</p>

<entries><group><archives>
Change order within grouped archive
# Change order within grouped archive

(Asked by: username_0 on 2018-07-24)

I have an archive of exhibitions with entries grouped by year. The order of the groups should be descending, the order of the entries within the group should be ascending.
For example: The order of the years should be 2018, 2017, 2016, …
The entries within the group 2018 should start with the first exhibition of the year and end with the last one.
Here is my code:
{% set archive = craft.entries.section("exhibitions").order('dateStart desc').dateEnd('<' ~ now).limit(null)  %}
{% set archiveGrouped = archive|group('dateStart.year') %}
{% for year, entriesInYear in archiveGrouped %}

    {{ year }}
    {% for entry in entriesInYear %}
    

And the link to the Website: https://kunsthausbaselland.ch/en/ausstellungen
I guess there is an easy solution for this. But I couldn’t figure it out and found nothing in the docs.

**Tags:** entries, group, archives


---

## 1 answers

### Answer by username_1 on 2018-07-24. Score: 2 | Accepted answer

Assuming the years are currently rendered in the correct (descending) order, an easy way to make sure the entries are rendered in ascending order would be to simply reverse the entriesInYear array, i.e.:
...

{% for entry in entriesInYear|reverse %}
    ...
{% endfor %}

> **Comments:**
> **username_0**: Jop, that works. I knew it’s gonna be an easy solution. :) Thanks a lot for the fast help!  

---

