Skip to content

Commit 2740f30

Browse files
committed
add pre and next post link
1 parent d1d3c16 commit 2740f30

File tree

5 files changed

+40
-100
lines changed

5 files changed

+40
-100
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ Configuration file: E:/GitWorkSpace/blog/_config.yml
316316

317317
## Update Log
318318

319-
### 2016.6.13
319+
### 2016.6.20
320320

321+
* `[+]` 在文章页中添加上一篇和下一篇文章链接。
321322
* `[^]` 修复标签云算法中被除数为零的 bug。[#26](https://github.com/Gaohaoyang/gaohaoyang.github.io/issues/26), [#28](https://github.com/Gaohaoyang/gaohaoyang.github.io/issues/28), [#30](https://github.com/Gaohaoyang/gaohaoyang.github.io/issues/30)
322323

323324
### 2016.5.11 v2.0.1

_includes/previousAndNext.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<div class="post-recent">
2+
{% if page.previous %}
3+
<div class="pre">
4+
5+
<p><strong>上一篇</strong> <a href="{{ page.previous.url | prepend: site.baseurl }}">{{ page.previous.title }}</a></p>
6+
{% endif %}
7+
</div>
8+
<div class="nex">
9+
10+
{% if page.next %}
11+
<p><strong>下一篇</strong> <a href="{{ page.next.url | prepend: site.baseurl }}">{{ page.next.title }}</a></p>
12+
{% endif %}
13+
</div>
14+
</div>

_layouts/post-old.html

Lines changed: 0 additions & 98 deletions
This file was deleted.

_layouts/post.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h1>{{page.title}}</h1>
3434
{{content}}
3535
</article>
3636
<hr>
37+
3738
{% assign hasSimilar = '' %}
3839
{% for post in site.related_posts %}
3940
{% assign postHasSimilar = false %}
@@ -61,6 +62,7 @@ <h2 id="similar_posts">Similar Posts</h2>
6162
</ul>
6263
{% endif %}
6364

65+
{% include previousAndNext.html %}
6466

6567
<h2 id="comments">Comments</h2>
6668
{% include comments.html %}

_sass/_post.scss

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@
3636
margin: 0;
3737
}
3838
}
39+
// .post-recent {
40+
// width: 100%;
41+
// overflow: hidden;
42+
// padding: 4px;
43+
// .pre{
44+
// width: 49%;
45+
// float: left;
46+
// }
47+
// .nex{
48+
// width: 49%;
49+
// float: right;
50+
// text-align: right;
51+
// }
52+
// p {
53+
// min-height: 70px;
54+
// box-sizing: border-box;
55+
// padding: 10px;
56+
// background-color: #fff;
57+
// box-shadow: 0 0 4px 0px rgba(0,0,0,0.15);
58+
// }
59+
// }
3960
}
4061
}
4162
@media screen and (max-width: 770px) {
@@ -54,7 +75,7 @@
5475
h5 {
5576
font-size: 16px;
5677
}
57-
h6{
78+
h6 {
5879
font-size: 15px;
5980
}
6081
}

0 commit comments

Comments
 (0)