Group talks by year

This commit is contained in:
Oliver Davies 2015-07-15 23:59:17 +01:00
parent 550de135f0
commit c7e3e36661

View file

@ -27,14 +27,21 @@ talks:
{% set talks = page.talks|reverse %} {% set talks = page.talks|reverse %}
{% set found = false %} {% set found = false %}
{% set year = '0' %}
{% for talk in talks|reverse if talk.date >= now %} {% for talk in talks|reverse if talk.date >= now %}
{% set found = true %} {% set found = true %}
{% if loop.first %} {% if loop.first %}
<h2>Upcoming Talks</h2> <h2>Upcoming Talks</h2>
<ul>
{% endif %} {% endif %}
{% include 'talk-listing-item' %} {% set this_year %}{{ talk.date|date('Y') }}{% endset %}
{% if this_year != year %}
<h3>{{ this_year }}</h3>
{% set year = this_year %}
{% endif %}
{{ talk.title }}<br>
<!--{% include 'talk-listing-item' %}-->
{% endfor %} {% endfor %}
{% if found %} {% if found %}
</ul> </ul>
@ -42,15 +49,17 @@ talks:
{% set found = false %} {% set found = false %}
{% for talk in talks if talk.date < now %} {% for talk in talks if talk.date < now %}
{% set found = true %}
{% if loop.first %} {% if loop.first %}
<h2>Previous Talks</h2> <h2>Previous Talks</h2>
<ul>
{% endif %} {% endif %}
{% include 'talk-listing-item' %} {% set this_year %}{{ talk.date|date('Y') }}{% endset %}
{% if this_year != year %}
<h3>{{ this_year }}</h3>
{% set year = this_year %}
{% endif %}
{{ talk.title }}<br>
<!-- {% include 'talk-listing-item' %} -->
{% endfor %} {% endfor %}
{% if found %}
</ul>
{% endif %}
{% endblock %} {% endblock %}