-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
79 lines (63 loc) · 2.8 KB
/
index.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
layout: default
---
<div class="archive">
{% assign tempPinnedNum = 0 -%}
<h1 class="archive-year">Pinned</h1>
<details open>
<summary class="summary-item">Click to hide or show all the pinned posts</summary>
{%- for post in site.posts -%}
{%- if post.pinned == true -%}
{% assign tempPinnedNum = tempPinnedNum | plus: 1 -%}
<div class="archive-item">
<span class="post-date archive-date fs-4">{{ post.date | date: "%Y-%m-%d" }} » </span>
<a style="font-weight:bold;" href="{{ post.url | relative_url }}" class="archive-title fs-4">{{ post.title }}</a>
</div>
{%- endif -%}
{%- endfor -%}
</details>
<!-- Pinned section specific assigned initial value for Total Post Number -->
{% assign tempPostNum = tempPinnedNum -%}
<!-- Try to define the latest new post -->
{% assign newPost = 0 -%}
{%- for post in site.posts -%}
{% assign postYear = post.date | date: "%Y" -%}
{% assign currYear = 'now' | date: "%Y" -%}
{%- if post.private == true -%}
{%- continue -%}
{%- endif -%}
{%- if postYear != postDateTemp -%}
{%- if postDateTemp != nil -%}
</details>
{%- endif -%}
<i>(Total Posts: {{ tempPostNum }})</i>
{% assign postDateTemp = postYear -%}
<h1 class="archive-year">{{ postYear }}</h1>
{%- if postYear == '2018' or postYear == '2020' -%}
<details>
{% assign tempPostNum = 0 -%}
{%- else -%}
<details open>
{% assign tempPostNum = 0 -%}
{%- endif -%}
<summary class="summary-item">Click to hide or show all the posts from year {{ postYear }}</summary>
{%- endif -%}
<!-- Only add the new button on the very latest post -->
{%- if newPost == 0 -%}
<div class="archive-item">
<span class="post-date archive-date fs-4">{{ post.date | date: "%Y-%m-%d" }} » 🆕 </span>
<a style="font-weight:bold;" href="{{ post.url | relative_url }}" class="archive-title fs-4">{{ post.title }}</a>
</div>
{% assign newPost = newPost | plus: 1 -%}
{%- else -%}
<div class="archive-item">
<span class="post-date archive-date fs-4">{{ post.date | date: "%Y-%m-%d" }} » </span>
<a style="font-weight:bold;" href="{{ post.url | relative_url }}" class="archive-title fs-4">{{ post.title }}</a>
</div>
{%- endif -%}
{% assign tempPostNum = tempPostNum | plus: 1 -%}
{%- endfor -%}
<!-- Reserve for the ending section of the archive -->
</details>
<i>(Total Posts: {{ tempPostNum }})</i>
</div>