Skip to content

Latest commit

 

History

History
38 lines (34 loc) · 1015 Bytes

posts.md

File metadata and controls

38 lines (34 loc) · 1015 Bytes
layout title
page
posts
{% if site.posts[0] %}
{% capture currentyear %}{{ 'now' | date: "%Y" }}{% endcapture %}
{% capture firstpostyear %}{{ site.posts[0].date | date: '%Y' }}{% endcapture %}
{% if currentyear == firstpostyear %}
    <h3>This year's posts</h3>
{% else %}  
    <h3>{{ firstpostyear }}</h3>
{% endif %}

{%for post in site.posts %}
  {% unless post.next %}
    <ul>
  {% else %}
    {% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
    {% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
    {% if year != nyear %}
      </ul>
      <h3>{{ post.date | date: '%Y' }}</h3>
      <ul>
    {% endif %}
  {% endunless %}
    <li><time>{{ post.date | date:"%d %b" }} - </time>
      <a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">
        {{ post.title }}
      </a>
    </li>
{% endfor %}
</ul>

{% endif %}