-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
85 lines (80 loc) · 2.43 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
80
81
82
83
84
85
---
layout: index
title: 欢迎
---
<!-- 生成内容列表 -->
{% if paginator.total_posts < 1 %}
<h4 class="center">啊偶,居然没有文章!!!</h4>
{% else %}
{% for post in paginator.posts %}
<div class="card-panel hoverable">
<div class="card-content">
<h5 class="card-title">
<a href="{{ post.url }}">{{ post.title }}</a>
</h5>
<hr>
<p onclick="description_on_preview()">
{% if post.excerpt.size > 32 %}
{{ post.excerpt }}
{% else %}
{{ post.content | strip_html | strip_newlines | truncate: 160 }}
{% endif %}
</p>
<div>
<i class="material-icons chip_align">local_offer</i>
{% for tag in post.tags %}
<span class="chip">{{ tag }}</span>
{% endfor %}
</div>
<div class="card-action">
{% if page.date %}
<span>
<i class="material-icons icon_align">event</i>{{ page.date | date: '%Y年%m月%d日' }}
</span>
{% endif %}
<span>
<i class="material-icons icon_align">link</i><a href="{{ post.url }}">阅读全文</a>
</span>
</div>
</div>
</div>
{% endfor %}
<!-- 分页 Pager indicator -->
<ul class="pagination">
{% if paginator.page > 2 %}
<li class="disabled"><a href="#!"><i class="material-icons">chevron_left</i></a></li>
{% endif %}
{% assign pageSize = 5 %}
{% assign startPage = paginator.page | minus:pageSize %}
{% if 2 > startPage %}
{% assign startPage = 2 %}
{% endif %}
{% assign endPage = paginator.page | plus:pageSize %}
{% if endPage >= paginator.total_pages %}
{% assign endPage = paginator.total_pages | minus:1 %}
{% endif %}
{% for count in (startPage..endPage) %}
{% if count == paginator.page %}
<li class="active"><a href="#">{{count}}</a></li>
{% else %}
<li class="waves-effect"><a href="/page{{count}}/">{{count}}</a></li>
{% endif %}
{% endfor %}
{% if paginator.next_page %}
<li class="waves-effect"><a href="/page{{paginator.next_page}}/">
<i class="material-icons">chevron_right</i></a>
</li>
{% endif %}
{% if paginator.page < paginator.total_pages%}
<li class="waves-effect"><a href="/page{{paginator.total_pages}}/">
<i class="material-icons">last_page</i></a>
</li>
{% endif %}
</ul>
{% endif %}
<script type="text/javascript">
function description_on_preview(){
$('.card-content').find('p').not($(this)).removeClass("flow-text");
$(this).toggleClass("flow-text");
}
</script>