Answers.Body: <p>If you change your query and sort by ascending postdate, it will start with the oldest and end with the newest:</p>
  
  <pre><code>    {% set entriesInYear = craft.entries.section('blog').limit(null).after(year).before(year+1).order('postDate asc') %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-04T15:06:58.617Z
Answers.Text: I never even thought about changing the order of the entries, I was too busy trying to change the order of the month groups. Thanks!
Answers.UserDisplayName: Steve Abraham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-03T17:03:45.843Z
Answers.LastActivityDate: 2016-04-03T17:03:45.843Z
Answers.UserDisplayName: megatrond
Body: <p>I'm creating a monthly archive page (for a specified year) for a section.</p>
  
  <p>Standard code to output the months and entries as follows:</p>
  
  <pre><code>{% set entriesInYear = craft.entries.section('blog').limit(null).after(year).before(year+1) %}
  
  {% for month, entries in entriesInYear | group("postDate|date('F')") %}
      &lt;div class="month"&gt;
          &lt;h3&gt;{{ month }}&lt;/h3&gt;
          &lt;ul&gt;
              {% for entry in entries %}
                  &lt;li&gt;{{ entry.getLink() }}&lt;/li&gt;
              {% endfor %}
          &lt;/ul&gt;
      &lt;/div&gt;&lt;!-- month --&gt;
  {% endfor %}
  </code></pre>
  
  <p>That's all working perfectly, what I can't figure out is how to reverse the order of the output, so I get January -> December, instead of December -> January.</p>
  
  <p>I'm sure this is simpler than my head is making out, but that will teach me to be coding on a Sunday.</p>
  
Tags: <entries><sorting><ordering><archives>
Title: Changing the order of an 'archive' page
ThreadText: # Changing the order of an 'archive' page
  
  (Asked by: username_0 on 2016-04-03)
  
  I'm creating a monthly archive page (for a specified year) for a section.
  
  Standard code to output the months and entries as follows:
  
  ```
  {% set entriesInYear = craft.entries.section('blog').limit(null).after(year).before(year+1) %}
  
  {% for month, entries in entriesInYear | group("postDate|date('F')") %}
      <div class="month">
          <h3>{{ month }}</h3>
          <ul>
              {% for entry in entries %}
                  <li>{{ entry.getLink() }}</li>
              {% endfor %}
          </ul>
      </div><!-- month -->
  {% endfor %}
  
  ```
  
  That's all working perfectly, what I can't figure out is how to reverse the order of the output, so I get January -> December, instead of December -> January.
  
  I'm sure this is simpler than my head is making out, but that will teach me to be coding on a Sunday.
  
  **Tags:** entries, sorting, ordering, archives
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-04-03. Score: 1 | Accepted answer
  
  If you change your query and sort by ascending postdate, it will start with the oldest and end with the newest:
  
  ```
      {% set entriesInYear = craft.entries.section('blog').limit(null).after(year).before(year+1).order('postDate asc') %}
  
  ```
  
  > **Comments:**
  > **username_0**: I never even thought about changing the order of the entries, I was too busy trying to change the order of the month groups. Thanks!  
  
  ---
  
  