diff --git a/templates/blog/blog_landing_page.html b/templates/blog/blog_landing_page.html index 98f87de0..7ef16e13 100644 --- a/templates/blog/blog_landing_page.html +++ b/templates/blog/blog_landing_page.html @@ -21,16 +21,20 @@ {# Group months by year #} {% for archive_date in date_list %} - {% ifchanged %} + {% ifchanged archive_date.year %} + {% if forloop.counter > 1 %} + {# Close the previous group, unless we're on the first trip through #} + + {% endif %} {% endifchanged %} {% routablepageurl self 'by-month' year=archive_date.year month=archive_date|date:"m" as blog_url %} - {% ifchanged %} - - {% endifchanged %} + {% if forloop.last %} + {# close the last optgroup #} + {% endif %} {% endfor %}