-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathpost.html
162 lines (141 loc) · 5.04 KB
/
post.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
layout: default
---
{% assign post_tag_m2 = false %}
{% assign post_tag_m1 = false %}
{% assign post_tag_p2 = false %}
{% assign post_tag_p1 = false %}
{% assign tag = page.categories.last %}
{% assign tag_posts = site.categories[tag] %}
{% for post in tag_posts %}
{% if post.url == page.url %}
{% break %}
{% endif %}
{% assign post_tag_m2 = post_tag_m1 %}
{% assign post_tag_m1 = post %}
{% endfor %}
{% assign tag_posts = site.categories[tag] | reverse %}
{% for post in tag_posts %}
{% if post.url == page.url %}
{% break %}
{% endif %}
{% assign post_tag_p2 = post_tag_p1 %}
{% assign post_tag_p1 = post %}
{% endfor %}
<article class="post">
<h1>{{ page.title }}</h1>
<!-- Look the author details up from the site config. -->
{% assign author = site.data.authors[page.author] %}
<div>
<span class="date">
{{ page.date | date: "%Y-%m-%d" }}
</span>
<!-- Output author details if some exist. -->
{% if author %}
<span>
<!-- Personal Info. -->
<a href="{{ author.web }}" style="font-size:14px;">作者: {{ author.name }}</a>
</span>
{% else %}
{% if page.categories.last != page.author %}
<span>
<!-- Personal Info. -->
<a style="font-size:14px;">作者: {{ page.author }}</a>
</span>
{% endif %}
{% endif %}
<ul class="tag">
<li>
<a href="{{ site.url }}{{ site.baseurl }}/categories/#{{ page.categories.last }}">
{{ page.categories.last }}
</a>
</li>
</ul>
{% if page.from %}
<span>
<!-- Personal Info. -->
<a href="{{ page.from }}" style="font-size:14px;">维基百科链接</a>
</span>
{% endif %}
<span style="float: right;" title="{{ page.tags[0] }}的其它文章">
<a style="font-size: 14px;" rel="nofollow" href="#sametag" class="tags">#{{ page.categories.last }} 的其它文章</a>
</span>
</div>
<div class="entry">
{% capture video_id %}{{ page.from | replace: "https://www.youtube.com/watch?v=",'' | replace: "https://youtu.be/", '' }}{% endcapture %}
{% if video_id contains "http://" or video_id contains "https://" %}
{% else %}
<iframe id="player-{{ video_id }}" type="text/html" width="640" height="360" src="https://www.youtube.com/embed/{{ video_id }}" frameborder="0" allowfullscreen></iframe>
{% endif %}
{% if page.photo %}
<img src="{{ page.photo }}" alt="{{ page.title }}的照片" align="right" style="max-width: 200px;"/>
{% endif %}
{{ content }}
</div>
{% include copyright.html %}
<div id="sametag">
<h4 style="display: inline-block;">#{{ page.categories.last }} 的其它文章</h4>
<span>--<a href="{{ site.url }}{{ site.baseurl }}{{ site.categories[tag].first.url }}">最新</a>-</span>
<span>-<a href="{{ site.url }}{{ site.baseurl }}{{ site.categories[tag].last.url }}">最早</a>--</span>
{% if post_tag_m2.url %}
<li>
<time>{{ post_tag_m2.date | date: "%Y-%m-%d" }}</time>
<a href="{{ site.url }}{{ site.baseurl }}{{ post_tag_m2.url }}">
{{ post_tag_m2.title }}
</a>
</li>
{% endif %}
{% if post_tag_m1.url %}
<li>
<time>{{ post_tag_m1.date | date: "%Y-%m-%d" }}</time>
<a href="{{ site.url }}{{ site.baseurl }}{{ post_tag_m1.url }}">
{{ post_tag_m1.title }}
</a>
</li>
{% endif %}
{% if post_tag_p1.url %}
<li>
<time>{{ post_tag_p1.date | date: "%Y-%m-%d" }}</time>
<a href="{{ site.url }}{{ site.baseurl }}{{ post_tag_p1.url }}">
{{ post_tag_p1.title }}
</a>
</li>
{% endif %}
{% if post_tag_p2.url %}
<li>
<time>{{ post_tag_p2.date | date: "%Y-%m-%d" }}</time>
<a href="{{ site.url }}{{ site.baseurl }}{{ post_tag_p2.url }}">
{{ post_tag_p2.title }}
</a>
</li>
{% endif %}
</div>
<hr>
<div class="pagination">
{% if page.previous.url %}
<span class="prev" >
<a href="{{ site.url }}{{ site.baseurl }}{{ page.previous.url }}">
前一篇:{{ page.previous.title }}
</a>
</span>
{% endif %}
{% if page.next.url %}
<span class="next" >
<a href="{{ site.url }}{{ site.baseurl }}{{ page.next.url }}">
後一篇:{{ page.next.title }}
</a>
</span>
{% endif %}
<script>
/* post pagination keyboard shortcuts */
document.body.onkeyup = function(e){
if (e.keyCode == '37') { window.location = '{{ site.url }}{{ site.baseurl }}{{ page.previous.url }}'; } // left arrow key
if (e.keyCode == '39') { window.location = '{{ site.url }}{{ site.baseurl }}{{ page.next.url }}'; } // right arrow key
if (e.keyCode == '45') { window.location = '{{ site.url }}{{ site.baseurl }}{{ post_tag_m1.url }}'; } // insert key
if (e.keyCode == '46') { window.location = '{{ site.url }}{{ site.baseurl }}{{ post_tag_p1.url }}'; } // delete key
};
</script>
{% include fab.html %}
</div>
{% include disqus.html %}
</article>