Skip to content

Instantly share code, notes, and snippets.

@opattison
Created March 1, 2014 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opattison/9291023 to your computer and use it in GitHub Desktop.
Save opattison/9291023 to your computer and use it in GitHub Desktop.
Jekyll post archive, organized by year headings.
{% for post in site.posts %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
{% if forloop.index0 != 0 %}
</ul>
{% endif %}
<h2>{{ post.date | date: '%Y' }}</h2><ul>
{% endif %}
<li><a href="{{ post.url }}">{{ post.title }}</a><br><time datetime="{{ post.date | date: "%Y-%m-%d" }}T{{ post.date | date: "%H:%M" }}">{{ post.date | date: "%B %d, %Y" }}</time></li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment