-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharchives.html
60 lines (51 loc) · 1.76 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: Blog Archives
---
<ul class="list-group">
{% assign year_count = 1 %}
{% assign month_count = 1 %}
{% for post in site.posts %}
{% capture year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture next_year %}{{ post.next.date | date: "%Y" }}{% endcapture %}
{% capture prev_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
{% if year != next_year %}
<li class="list-group-item">
<a class="list-toggle" href="#">
<i class="fa fa-plus-square"></i>
{{ post.date | date: "%Y" }}
</a>
<ul class="list-group hidden">
{% else %}
{% capture year_count %}{{ year_count | plus: 1 }}{% endcapture %}
{% endif %}
{% capture month %}{{ post.date | date: "%m%Y" }}{% endcapture %}
{% capture next_month %}{{ post.next.date | date: "%m%Y" }}{% endcapture %}
{% capture prev_month %}{{ post.previous.date | date: "%m%Y" }}{% endcapture %}
{% if month != next_month or forloop.first %}
<li class="list-group-item">
<a class="list-toggle" href="#">
<i class="fa fa-plus-square"></i>
{{ post.date | date: "%B" }}
</a>
<ul class="list-group hidden">
{% else %}
{% capture month_count %}{{ month_count | plus: 1 }}{% endcapture %}
{% endif %}
<li class="list-group-item">
<span class="label label-info">{{ post.date | date_to_string }}</span>
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
</li>
{% if month != prev_month or forloop.last %}
</ul>
<span class="badge">{{ month_count }}</span>
{% assign month_count = 1 %}
</li>
{% endif %}
{% if year != prev_year or forloop.last %}
</ul>
<span class="badge">{{ year_count }}</span>
{% assign year_count = 1 %}
</li>
{% endif %}
{% endfor %}
</ul>