Jekyll/Liquid Templating: How to group blog posts by year?

It can be done with much, much less Liquid code than in the existing answers: {% for post in site.posts %} {% assign currentdate = post.date | date: “%Y” %} {% if currentdate != date %} <li id=”y{{currentdate}}”>{{ currentdate }}</li> {% assign date = currentdate %} {% endif %} <li><a href=”https://stackoverflow.com/questions/19086284/{{ post.url }}”>{{ post.title }}</a></li> … Read more