{%- assign list_items = include.list_items -%} {%- assign list_type = include.list_type -%}
<div class=“archive-list”>
{%- if list_type == "posts" -%} {% assign posts_by_years = list_items | group_by_exp: 'post', 'post.date | date: "%Y"' %} {% for year in posts_by_years %} <a data-toggle="collapse" href="#posts_in_{{ year.name }}" role="button" aria-expanded="false" aria-controls="posts_in_{{ year.name }}"> <h2 id="posts_in_{{ year.name }}_heading">{{ year.name }}</h2> </a> <div class="collapse show" id="posts_in_{{ year.name }}"> <ul> {% for post in year.items %} {% include archive-single.html item=post %} {% endfor %} </ul> </div> {% endfor %} {%- else -%} {% assign taxonomies = list_items %} {% for taxonomy in taxonomies %} {%- capture tax_0 -%} {{ taxonomy[0] | slugify }} {%- endcapture -%} <a data-toggle="collapse" href="#posts_in_{{ tax_0 }}" role="button" aria-expanded="false" aria-controls="posts_in_{{ tax_0 }}"> <h2 id="posts_in_{{ tax_0 }}_heading">{{ tax_0 }}</h2> </a> <div class="collapse show" id="posts_in_{{ tax_0 }}"> <ul> {% for post in taxonomy[1] %} {% include archive-single.html item=post %} {% endfor %} </ul> </div> {% endfor %} {%- endif -%}
</div>