Skip to content

Commit e102cd5

Browse files
committed
add Recommended Posts in article
1 parent e6dcada commit e102cd5

File tree

12 files changed

+75
-11
lines changed

12 files changed

+75
-11
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Cafe 主题旨在追求简约、操作简单、阅读舒适度。 英文版介绍 [Read in English](https://github.com/giscafer/hexo-theme-cafe/blob/master/README_en.md)
44

5-
Inspire by [Landscape](https://github.com/hexojs/hexo-theme-landscape)目前版本主要调整了整体的样式,布局细调,以及新增一些widget等,后期会在使用的过程中不断进行调整。
5+
灵感来自 [Landscape](https://github.com/hexojs/hexo-theme-landscape)参考[@ruanyf](http://www.ruanyifeng.com/blog)博客调整了整体的样式,一些布局细调,以及新增一些 widge t等,后期会在使用的过程中不断进行调整。
66

77

88
体验参考本人博客 [Giscafer's blog](http://blog.giscafer.com)
@@ -61,6 +61,7 @@ Inspire by [Landscape](https://github.com/hexojs/hexo-theme-landscape),目前
6161
- 网易云跟帖
6262
- 畅言
6363
- 友言
64+
- gitment
6465

6566

6667

@@ -83,8 +84,6 @@ Cafe 主题提供以下内置 widgets:
8384
- tagcloud # 云标签
8485
- archives # 归档
8586
- recent_posts # 最新文章
86-
- lastest_comments # 最新评论
87-
- hot_comment_posts # 热评文章
8887
- friendly_link # 友情链接
8988

9089
你可以在主题配置文件 `widget` 设置选项设置需要的 widgets。

README_en.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ widgets:
6565
- tagcloud
6666
- recent_posts
6767
- archive
68-
- lastest_comments
69-
- hot_comment_posts
68+
7069

7170
# display widgets at the bottom of index pages (pagination == 2)
7271
index_widgets:

_config.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ sidebar: right
3737
content_position: widget
3838
# true目录将会浮动固定位置,false则相反,当且仅当content_position=widget时该设置值有效
3939
content_display_fixed: true
40+
41+
# 文章底部推荐文章,false关闭
42+
random_posts: true
43+
4044
widgets:
4145
- social
4246
- post_content
@@ -95,7 +99,7 @@ favicon: /favicon.png
9599

96100
## 网易云跟帖
97101
### 使用说明 http://cafe.giscafer.com/2017/04/14/gentie-test/
98-
gentie_productKey: false
102+
gentie_productKey: e2fb4051c49842688ce669e634bc983f
99103

100104
## 畅言 (不使用请将appid和appkey都设空或者false)
101105
### 使用说明:http://changyan.kuaizhan.com/static/help/
@@ -109,7 +113,7 @@ youyan_uid: false
109113
# gitment
110114
## 教程:https://imsun.net/posts/gitment-introduction/ 网站上进行查看
111115
gitment:
112-
enable: true #如果不使用则设置false关闭
116+
enable: false #如果不使用则设置false关闭
113117
owner: giscafer # 你的github名称或者id id的获取方式为https://api.github.com/users/forvoid(你的名称)中的id极为github id
114118
repo: giscafer.github.io # 你的留言存放的位置 我的是放在我的github的github page上面
115119
client_id: 7e5dd6cdb9xxaxa4cf91a # Register a new OAuth application https://github.com/settings/applications/new

languages/default.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ archive_a: 归档
1313
archive_b: 归档:%s
1414
page: 第 %d 页
1515
recent_posts: 最新文章
16+
random_posts: 推荐文章
1617
newer: 上一篇
1718
older: 下一篇
1819
share: 分享

languages/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ archive_a: Archives
1515
archive_b: "Archives: %s"
1616
page: Page %d
1717
recent_posts: Recent Posts
18+
random_posts: Recommended Posts
1819
newer: Newer
1920
older: Older
2021
share: Share

languages/zh-CN.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ archive_a: 归档
1515
archive_b: 归档:%s
1616
page: 第 %d 页
1717
recent_posts: 最新文章
18+
random_posts: 推荐文章
1819
newer: 上一篇
1920
older: 下一篇
2021
share: 分享

languages/zh-TW.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ archive_a: 彙整
1515
archive_b: 彙整:%s
1616
page: 第 %d 頁
1717
recent_posts: 最新文章
18+
random_posts: 推荐文章
1819
newer: Newer
1920
older: Older
2021
share: Share

layout/_partial/article.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
</footer>
4242
</div>
4343
<% if (!index){ %>
44+
<%- partial('random_posts') %>
4445
<%- partial('post/nav') %>
4546
<% } %>
4647
</article>

layout/_partial/random_posts.ejs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<% if (theme.random_posts){ %>
2+
<div id="random_posts">
3+
<h2><%= __('random_posts') %></h2>
4+
<div>
5+
<ul>
6+
<% arr = site.posts.slice(); %>
7+
<% for (var i, tmp, n = arr.length; n; i = Math.floor(Math.random() * n), tmp = arr[--n], arr[n] = arr[i], arr[i] = tmp); %>
8+
<% arr = arr.slice(0,6);%>
9+
<% arr.each(function(post){ %>
10+
<li>
11+
<strong><%= date(post.date, 'YYYY.MM.DD')%>:&nbsp;&nbsp;<a href="<%- url_for(post.path) %>"><%= post.title || '(no title)' %></a></strong>
12+
<div class="post-excerpt">
13+
<%- post.excerpt.replace(/img/g,'').substring(0,150) %>
14+
</div>
15+
</li>
16+
<% }) %>
17+
</ul>
18+
</div>
19+
</div>
20+
<% } %>

source/css/_partial/article.styl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
.article-title
3232
text-decoration: none
3333
font-size: 2em
34-
font-weight: bold
34+
font-weight: 500;
35+
color: #333;
36+
padding: 0 0 0.2em 0;
3537
color: color-default
3638
line-height: line-height-title
3739
transition: color 0.2s
@@ -49,7 +51,7 @@
4951
line-height: line-height
5052
margin: 0.8em 0
5153
h1, h2, h3, h4, h5, h6
52-
font-weight: bold
54+
font-weight: 500
5355
h1, h2, h3, h4, h5, h6
5456
line-height: line-height-title
5557
margin: line-height-title 0
@@ -73,7 +75,7 @@
7375
border-collapse: collapse
7476
border-spacing: 0
7577
th
76-
font-weight: bold
78+
font-weight: 500
7779
border-bottom: 3px solid color-border
7880
padding-bottom: 0.5em
7981
td
@@ -229,7 +231,7 @@
229231
letter-spacing: 2px
230232
color: color-grey
231233
line-height: 1em
232-
font-weight: bold
234+
font-weight: 500
233235
#article-nav-newer &
234236
margin-right: -2px
235237

0 commit comments

Comments
 (0)