Skip to content

Instantly share code, notes, and snippets.

@zhonger
Created March 25, 2021 11:40
Show Gist options
  • Save zhonger/72dd3ddde762f8b040f25c53c12c70c7 to your computer and use it in GitHub Desktop.
Save zhonger/72dd3ddde762f8b040f25c53c12c70c7 to your computer and use it in GitHub Desktop.
jekyll.archives.html
---
layout: page
home-title: Welcome to zhonger's blog!
description: Writing, writing, writing ...
permalink: /archives.html
cover: https://images.unsplash.com/photo-1465189684280-6a8fa9b19a7a?w=1600&q=900
---
<h2>Archives</h2>
{% for post in site.posts %}
{% unless post.next %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% if year != nyear %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% endif %}
{% endunless %}
<li><p class="archives-title"><span class="archives-date">{{ post.date | date: "%b %-d, %Y" }} </span><a href="{{ post.url | prepend: site.baseurl }}"> {{ post.title }} </a></p></li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment