-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathposts_archive.html
More file actions
63 lines (57 loc) · 1.82 KB
/
posts_archive.html
File metadata and controls
63 lines (57 loc) · 1.82 KB
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
61
62
63
---
layout: page
title: Posts Archive
permalink: /archive/posts/
---
<div class="posts-archive">
<h2 class="page-heading">Posts Archive</h2>
{% comment %} Collect distinct years {% endcomment %}
{% assign years = "" %}
{% for post in site.posts %}
{% assign y = post.date | date: "%Y" %}
{% unless years contains y %}
{% if years != "" %}{% assign years = years | append: "," %}{% endif %}
{% assign years = years | append: y %}
{% endunless %}
{% endfor %}
{% assign year_list = years | split: "," %}
{% comment %} Jump nav {% endcomment %}
<nav class="timeline-nav" aria-label="Jump to year">
{% for y in year_list %}
{% unless forloop.first %} · {% endunless %}
<a href="#y{{ y }}" class="muted-link">{{ y }}</a>
{% endfor %}
</nav>
{% comment %} Timeline {% endcomment %}
<div class="timeline">
{% assign currentyear = "" %}
{% assign currentmonth = "" %}
{% for post in site.posts %}
{% assign y = post.date | date: "%Y" %}
{% assign m = post.date | date: "%B" %}
{% if y != currentyear %}
{% unless forloop.first %}
</ul>
</div>
{% endunless %}
{% assign currentyear = y %}
{% assign currentmonth = "" %}
<div class="timeline-year" id="y{{ y }}">{{ y }}</div>
<div class="timeline-year-posts">
{% endif %}
{% if m != currentmonth %}
{% unless currentmonth == "" %}</ul>{% endunless %}
{% assign currentmonth = m %}
<h4 class="timeline-month">{{ m }}</h4>
<ul class="timeline-post-list">
{% endif %}
<li>
<a class="muted-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% if forloop.last %}
</ul>
</div>
{% endif %}
{% endfor %}
</div>
</div>