| --- |
| layout: archive |
| lang: en |
| ref: year-archive |
| permalink: /year-archive/ |
| author_profile: true |
| --- |
| |
| <ul class="nav nav-tabs"> |
| <li data-toggle="tab" class="active title"><a data-toggle="tab" href="#postByYear">Posts by Year</a></li> |
| <li data-toggle="tab" class="title"><a data-toggle="tab" href="#postByTag">Posts by Tag</a></li> |
| </ul> |
| |
| <div class="tab-content"> |
| <div id="postByYear" class="tab-pane active"> |
| {% capture written_year %}'None'{% endcapture %} |
| {% assign posts=site.posts | where: "lang", page.lang %} |
| {% for post in posts %} |
| {% capture year %}{{ post.date | date: '%Y' }}{% endcapture %} |
| {% if year != written_year %} |
| <h2 id="{{ year | slugify }}" class="archive__subtitle">{{ year }}</h2> |
| {% capture written_year %}{{ year }}{% endcapture %} |
| {% endif %} |
| {% include archive-single.html %} |
| {% endfor %} |
| </div> |
| <div id="postByTag" class="tab-pane fade"> |
| {% include base_path %} |
| {% assign collections = site.posts | where: "lang", page.lang %} |
| {% include group-by-array collection=collections field="tags" %} |
| |
| {% for tag in group_names %} |
| {% assign posts = group_items[forloop.index0] %} |
| <h2 id="{{ tag | slugify }}" class="archive__subtitle">{{ tag }}</h2> |
| {% for post in posts %} |
| {% include archive-single.html %} |
| {% endfor %} |
| {% endfor %} |
| </div> |
| </div> |