January 25, 2016

Code Snippet: List Posts Published Before a Given Year in Jekyll

<ul>
    {% for post in site.posts %}
    {% capture year %}{{post.date | date: "%Y"}}{% endcapture %}
        {% if year < "2014" %}
        <li><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></li>
        {% endif %}
    {% endfor %}
</ul>
categories: code-snippets, jekyll