generated from TMaize/tmaize-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (44 loc) · 1.57 KB
/
index.html
File metadata and controls
48 lines (44 loc) · 1.57 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
---
layout: page
title: 首页
---
<canvas
id="particle-canvas"
style="position: fixed; top: 0; left: 0; z-index: -1; pointer-events: none; width: 100%; height: 100%"></canvas>
<div class="page page-index">
{% for post in site.posts -%} {%- capture post_year %}{{ post.date | date: "%Y" }}{% endcapture -%} {%- capture
post_previous_year %}{{ post.previous.date | date: "%Y" }}{% endcapture -%} {%- capture post_next_year %}{{
post.next.date | date: "%Y" }}{% endcapture -%} {%- if forloop.first or post_next_year != post_year -%}
<div class="list-post">
<!-- 后面加入当年发布的post个数 -->
<h2 id="{{post_year}}">{{post_year}} (0)</h2>
<ul>
{%- endif %}
<li>
<span class="date">{{ post.date | date: "%Y/%m/%d" }}</span>
<div class="title">
<a href="{{ site.baseurl | append: post.url }}" class="hover-underline">{{ post.title }}</a>
</div>
<div class="tags">
{% for tag in post.tags -%}
<a href="{{site.baseurl}}/pages/tags.html#{{ tag }}">{{ tag }}</a>
{%- endfor %}
</div>
</li>
{%- if forloop.last or post_previous_year != post_year %}
</ul>
</div>
{%- endif %} {%- endfor %}
</div>
<script>
window.addEventListener('load', function () {
var years = document.getElementsByClassName('list-post')
for (var i = 0; i < years.length; i++) {
var year = years[i]
var count = year.getElementsByTagName('li').length
var h2 = year.getElementsByTagName('h2')[0]
h2.textContent = h2.textContent.replace('(0)', '(' + count + ')')
}
})
</script>
<script src="{{ site.baseurl }}/static/js/particle.js"></script>