Using this handy thing (http://buildwithcraft.com/help/entry-archive) to create an archive page, but not quite doing what I need it to do.
Set up as a route to call /year/month
, replacing year with current year if not provided and replacing month with most recent month that has posts in it if not provided.
This version will print out all posts from a single year:
{% set entriesInYear = craft.entries.section('pressReleases').limit(null).after(year).before(year+1) %}
{% for entry in entriesInYear %}
<p>{{ entry.title }}</p>
{% endfor %}
And this version will print out the entire year into groups based on month:
{% for month, entries in entriesInYear | group("postDate|date('F')") %}
<h2>{{ month }}</h2>
<ul>
{% for entry in entries %}
<li>{{ entry.getLink() }}</li>
{% endfor %}
</ul>
{% endfor %}
But what I need is to only get the posts from the month in the url and am not sure how to get there... basically an entriesInMonth
variable as opposed to an entriesInYear
.