-
Notifications
You must be signed in to change notification settings - Fork 3
/
archive.html
61 lines (61 loc) · 2.27 KB
/
archive.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
61
---
layout: default
title: "归档"
---
{% capture archives_year %}1900{% endcapture %}
{% capture archives_month %}0{% endcapture %}
{% capture is_first_year %}1{% endcapture %}
{% capture expanded %}true{% endcapture %}
<div class="accordion mb-3" id="archive">
{% for post in site.posts %}
{% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% capture post_month %}{{ post.date | date: '%-m' }}{% endcapture %}
{% if archives_year != post_year %}
{% assign archives_year = post_year %}
{% if is_first_year != "1" %}
</ul>
</div>
</div>
{% else %}
{% assign is_first_year = "0" %}
{% endif %}
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button{% if expanded %}{% else %} collapsed{% endif %}" type="button" data-bs-toggle="collapse" data-bs-target="#flush-{{ archives_year }}" aria-expanded="{% if expanded %}true{% else %}false{% endif %}" aria-controls="flush-{{ archives_year }}">
{{ archives_year }}
</button>
</h2>
<div id="flush-{{ archives_year }}" class="accordion-collapse collapse{% if expanded %} show{% endif %}" data-bs-parent="#archive">
<ul class="list-group list-group-flush">
{% endif %}
{% if expanded %}{% assign expanded = false %}{% endif %}
{% if archives_month != post_month %}
{% assign archives_month = post_month %}
<li class="list-group-item">
<h6 class="mb-0">{% case post_month %}
{% when '1' %}一月
{% when '2' %}二月
{% when '3' %}三月
{% when '4' %}四月
{% when '5' %}五月
{% when '6' %}六月
{% when '7' %}七月
{% when '8' %}八月
{% when '9' %}九月
{% when '10' %}十月
{% when '11' %}十一月
{% when '12' %}十二月
{% endcase %}</h6>
</li>
{% endif %}
<li class="list-group-item">
<span class="fw-bold">{{ post.date | date: "%d" }}</span>
<a class="link-underline link-underline-opacity-0 link-underline-opacity-100-hover" href="{{post.url}}" target="_blank">
{{ post.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>