date_group not working as expected

I'm trying to show a list of events grouped by month. The events are retrieved from a collection called 'calendar', which has a date field called 'event_date'. When I use the following code, I see the list, with the events sorted by event date, but with months repeated (which is expected given the code).

{{ collection:calendar group_by_date="F Y | date" sort="event_date" show_future="true" show_past="false" }}
<h3>{{ event_date format="F Y"}}</h3>
<p>{{ event_date format="l, F j, Y"}} — {{ title }}</p>
{{ /collection:calendar }}

This looks like this:

September 2020
Tuesday, September 8, 2020 — First day of school!

September 2020
Thursday, September 24, 2020 — Another event in September

October 2020
Friday, October 9, 2020 — Event in October

October 2020
Friday, October 30, 2020 — Another event in October

I'd like to use date_groups to group events by month, like this:

September 2020
Tuesday, September 8, 2020 — First day of school!
Thursday, September 24, 2020 — Another event in September

October 2020
Friday, October 9, 2020 — Event in October
Friday, October 30, 2020 — Another event in October

However, I can't seem to get date_groups to work correctly. I tried to follow the documentation, but when I use the code below, all I see is a blank page.

{{ collection:calendar group_by_date="F Y | date" sort="event_date" show_future="true" show_past="false" as="entries" }}
{{ date_groups }}
<h3>{{ event_date format="F Y"}}</h3>
{{ entries }}
<p>{{ event_date format="l, F j, Y"}} — {{ title }</p>
{{ /entries }}
{{ /date_groups }}
{{ /collection:calendar }}

What am I doing wrong?

Thanks!
--Ron

>>>>>>> Unanswered <<<<<<<
3 Replies
2 Followers