forked from alecharp/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archives.html
27 lines (25 loc) · 851 Bytes
/
archives.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
layout: page
title: Archive
---
<div id="archive">
<h2>Archives</h2>
{% for post in site.posts %}
{% unless post.next %}
<h3>{{ post.date | date: '%Y' }}</h3>
<h4>{{ post.date | date: '%B' }}</h4>
{% else %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture month %}{{ post.date | date: '%m' }}{% endcapture %}
{% capture nyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
{% capture nmonth %}{{ post.next.date | date: '%m' }}{% endcapture %}
{% if year != nyear %}
<h3>{{ post.date | date: '%Y' }}</h3>
{% endif %}
{% if month != nmonth || year != nyear %}
<h4>{{ post.date | date: '%B' }}</h4>
{% endif %}
{% endunless %}
<p><a href="{{ post.url }}">{{ post.title }}</a></p>
{% endfor %}
</div>