Answers.Body: <p>You're close!</p>
  <p>We've got an example of how to do this here: <a href="http://buildwithcraft.com/help/entry-archive#grouping-by-year-and-then-month" rel="nofollow noreferrer">http://buildwithcraft.com/help/entry-archive#grouping-by-year-and-then-month</a></p>
  <p>The trick is to group by year first, then by month.  Using the 'F' token is how to <a href="https://www.php.net/manual/en/function.date.php" rel="nofollow noreferrer">tell PHP</a> to display the name of the month.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-10T16:43:47.697Z
Answers.Text: Thanks Brad, this seems like it will do the trick. Can I still use the {{ year }} tag inside the month loop so it gives me August - 2014 as a title?
Answers.UserDisplayName: Daryl Campbell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-10T17:17:44.343Z
Answers.Text: Yup... will still work fine there.  If that gets you what you want, mind marking this as the correct answer?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-10T16:19:56.177Z
Answers.LastActivityDate: 2014-08-10T16:19:56.177Z
Answers.LastEditDate: 2023-11-17T20:38:18.640Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have this piece of code which orders my entries by month, which is working great. I only have two issues which I can't work out. How would I display the year of the month beside the month title eg:</p>
  
  <pre><code>&lt;h2&gt;{{ month }} &gt; {{ year }}&lt;/h2&gt;
  </code></pre>
  
  <p>As the list could run over a number of years it would be good to distinguish this. The next part is I can't seem to convert the month from a number ie: 8 to the word ie. "august". When I filter it, it just returns "Jan".</p>
  
  <pre><code>{% set allEntries = craft.entries.section('featureArticles').find() %}
  {% set allEntriesByMonth = allEntries|group('postDate.month') %}
  
  {% for month, entriesInMonth in allEntriesByMonth %}
  
      &lt;h2&gt;{{ month }}&lt;/h2&gt;
  
      &lt;ul&gt;
          {% for entry in entriesInMonth %}
              &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  
  {% endfor %}
  </code></pre>
  
Tags: <entries><date>
Title: Outputting Year of Entry Group alongside Month
ThreadText: # Outputting Year of Entry Group alongside Month
  
  (Asked by: username_0 on 2014-08-10)
  
  I have this piece of code which orders my entries by month, which is working great. I only have two issues which I can't work out. How would I display the year of the month beside the month title eg:
  
  ```
  <h2>{{ month }} > {{ year }}</h2>
  
  ```
  
  As the list could run over a number of years it would be good to distinguish this. The next part is I can't seem to convert the month from a number ie: 8 to the word ie. "august". When I filter it, it just returns "Jan".
  
  ```
  {% set allEntries = craft.entries.section('featureArticles').find() %}
  {% set allEntriesByMonth = allEntries|group('postDate.month') %}
  
  {% for month, entriesInMonth in allEntriesByMonth %}
  
      <h2>{{ month }}</h2>
  
      <ul>
          {% for entry in entriesInMonth %}
              <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
          {% endfor %}
      </ul>
  
  {% endfor %}
  
  ```
  
  **Tags:** entries, date
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-10. Score: 3 | Accepted answer
  
  You're close!
  
  We've got an example of how to do this here: <http://buildwithcraft.com/help/entry-archive#grouping-by-year-and-then-month>
  
  The trick is to group by year first, then by month. Using the 'F' token is how to [tell PHP](https://www.php.net/manual/en/function.date.php) to display the name of the month.
  
  > **Comments:**
  > **username_0**: Thanks username_1, this seems like it will do the trick. Can I still use the {{ year }} tag inside the month loop so it gives me August - 2014 as a title?  
  > **username_1**: Yup... will still work fine there.  If that gets you what you want, mind marking this as the correct answer?  
  
  ---
  
  