{%- for post in site.posts -%} {%- capture current_year -%}{{ post.date | date: "%Y" }}{%- endcapture -%} {%- unless current_year == previous_year -%} {{ current_year }} {%- assign previous_year = current_year -%} {%- endunless -%} {{ post.title | escape }} {%- endfor -%}