Skip to content

Instantly share code, notes, and snippets.

@mfin
Created May 30, 2012 21:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfin/2838983 to your computer and use it in GitHub Desktop.
Save mfin/2838983 to your computer and use it in GitHub Desktop.
Jekyll - posts by year
<ul class="posts">
<span>Articles</span>
{% for post in site.posts %}
{% unless post.next %}
<div class="line"><span>{{ post.date | date: '%Y' }}</span></div>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
<div class="line"><span>{{ post.date | date: '%Y' }}</span></div>
{% endif %}
{% endunless %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment