diff --git a/_config.yml b/_config.yml
index a8bed11..e8840f9 100755
--- a/_config.yml
+++ b/_config.yml
@@ -55,7 +55,6 @@ article:
related_posts:
enable: false
max_count: 5
- auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。
######## Comments ########
diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml
index 2b2b8ab..ce87ae3 100755
--- a/languages/zh-CN.yml
+++ b/languages/zh-CN.yml
@@ -15,10 +15,10 @@ meta:
recent_update: 最近更新
toc: 本文目录
read_next: 接下来阅读
- prev: 上一篇
- next: 下一篇
- older: 较早
- newer: 较新
+ prev: 回顾上一篇
+ next: 接下来阅读
+ older: 较早文章
+ newer: 较新文章
references: 参考资料
related_posts: 您可能感兴趣的文章
comment_title: 快来参与讨论吧
diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml
index bc1f210..c874176 100755
--- a/languages/zh-TW.yml
+++ b/languages/zh-TW.yml
@@ -15,10 +15,10 @@ meta:
recent_update: 最近更新
toc: 本文目錄
read_next: 接下來閱讀
- prev: 上一篇
- next: 下一篇
- older: 較早
- newer: 較新
+ prev: 回顧上一篇
+ next: 接下來閱讀
+ older: 較早文章
+ newer: 較新文章
references: 參考資料
related_posts: 您可能感興趣的文章
comment_title: 參與討論
diff --git a/layout/_partial/main/article/read_next.ejs b/layout/_partial/main/article/read_next.ejs
index 9551cec..a7cea44 100644
--- a/layout/_partial/main/article/read_next.ejs
+++ b/layout/_partial/main/article/read_next.ejs
@@ -25,30 +25,26 @@ function layoutDiv() {
}
});
}
- if (next == undefined) {
- // 项目的最后一篇文档
- return '
';
- }
}
let el = '';
if (prev || next) {
el += '
';
diff --git a/scripts/helpers/related_posts.js b/scripts/helpers/related_posts.js
index e951fbb..87e190c 100644
--- a/scripts/helpers/related_posts.js
+++ b/scripts/helpers/related_posts.js
@@ -25,58 +25,30 @@ hexo.extend.helper.register('popular_posts_wrapper', function(args){
const posts = this.site.posts;
const root = this.config.root;
- function generateHTML(list){
+ function listItem(obj){
var el = '';
- el += '';
+ el += '';
var p = posts.filter(function(p) {
- return root + p.path == list.path;
+ return root + p.path == obj.path;
});
if (p && p.length > 0) {
p = p.data[0];
}
- if (p) {
- if (p.cover) {
- if (p.cover.includes('/')) {
- list.img = p.cover;
- } else {
- list.img = 'https://source.unsplash.com/1280x640/?' + p.cover;
- }
- } else if (cfg.auto_cover && p.tags && p.tags.length > 0) {
- var params = '';
- p.tags.reverse().forEach((tag, i) => {
- if (i > 0) {
- params += ',';
- }
- params += tag.name;
- });
- list.img = 'https://source.unsplash.com/1280x640/?' + params;
- }
+ el += '' + obj.title + '';
+ if (obj.excerpt && obj.excerpt.length > 0) {
+ el += '' + util.truncate(util.stripHTML(obj.excerpt), {length: 120}) + '';
}
- if (hexo.theme.config.default.cover) {
- el += ''
- if (list.img && list.img != "") {
- el += '
';
- } else {
- el += '
';
- }
- el += '
';
- }
-
- el += '' + list.title + '';
-
- if (list.excerpt && list.excerpt.length > 0) {
- el += '' + util.truncate(util.stripHTML(list.excerpt), {length: 120}) + '';
- }
-
el += '';
return el;
}
- for(var i = 0; i < json.length; i++) {
- returnHTML += generateHTML(json[i]);
+ if (json.length > 0) {
+ for(var i = 0; i < json.length; i++) {
+ returnHTML += listItem(json[i]);
+ }
}
-
+
if (returnHTML != "") returnHTML = "" + returnHTML + "
";
div += returnHTML;
div += '';
diff --git a/source/css/_layout/partial/related.styl b/source/css/_layout/partial/related.styl
index b3ac680..ed96de8 100644
--- a/source/css/_layout/partial/related.styl
+++ b/source/css/_layout/partial/related.styl
@@ -21,105 +21,71 @@
.related-wrap#related-posts
.related-posts
width: 100%
- display: flex
margin: 1rem 0
- overflow-x: scroll
- align-items: flex-start
- scrollbar(8px, 4px)
- padding-bottom: 8px
border-radius: $border-block
- a
- flex-grow: 0
- flex-shrink: 0
- background: var(--card)
- border-radius: $border-block
- padding-bottom: 1rem
+ background: var(--block)
+ overflow: hidden
+ border: 1px solid var(--block-border)
+ .item
line-height: 1.2
- display: flex
- flex-direction: column
- overflow: hidden
- min-width: 280px
- width: 40vw
- max-width: 460px
- border: 1px solid var(--block-hover)
- z-index: 1
- .img
- min-width: 100%
- min-height: 140px
- height: "calc(%s * 0.5)" % @width
- max-height: 230px
- overflow: hidden
- img
- width: 100%
- height: 100%
- object-fit: cover
- &:not(.lazy)
- trans1: transform 1s
- @media screen and (max-width: $device-tablet)
- width: 70vw
- .img
- height: "calc(%s * 0.5)" % @width
+ display: block
+ padding: 1rem
.title
color: var(--text-p1)
font-weight: 500
- font-size: $fs-15
- margin: .75rem .75rem 0 .75rem
+ font-size: 1rem
display: -webkit-box
-webkit-box-orient: vertical
overflow: hidden
-webkit-line-clamp: 2
.excerpt
- color: var(--text-p2)
- font-size: $fs-13
- margin: 0.4rem .75rem 0 .75rem
+ color: var(--text-p3)
+ font-size: $fs-12
+ margin-top: 0.5rem
display: -webkit-box
-webkit-box-orient: vertical
overflow: hidden
-webkit-line-clamp: 3
&:hover
- img
- transform: scale(1.04)
- a+a
- margin-left: 1rem
+ background: var(--block-hover)
+ .item+.item
+ border-top: 1px dashed var(--block-border)
.related-wrap#read-next
.body
- background: var(--block)
- border-radius: $border-block
- border: 1px solid var(--block-border)
margin-top: 1rem
- overflow: hidden
- .line
- margin: 0
- height: 1px
- background: var(--block-border)
- &+.line,&:first-child,&:last-child
- display: none
+ display: grid
+ grid-gap: 16px
+ grid-template-columns: repeat(auto-fill, "calc((100% - 1 * %s) / 2)" % 16px)
>a
display: flex
+ flex-direction: column
margin: 0
line-height: 1.2
padding: 0.75rem 0.5rem
- color: var(--text-p3)
- justify-content: space-between
- align-items: center
- font-weight: 500
- font-size: $fs-12
- &:first-child
- color: var(--text-p1)
- font-size: $fs-h4
- font-weight: 400
+ color: var(--text-p1)
+ font-size: 1rem
+ background: var(--card)
+ border-radius: $border-block
+ box-shadow: $boxshadow-card
+ trans2: box-shadow transform
+ &:last-child
+ text-align: right
.note
flex-shrink: 0
- margin-left: 4px
+ margin-bottom: 4px
font-size: $fs-12
color: var(--text-p4)
font-weight: 500
&:hover
color: $color-hover !important
- background: var(--card)
-
+ box-shadow: $boxshadow-card-float
+ transform: translateY(-1px)
+.wiki+.related-wrap#read-next .body>a
+ font-size: $fs-h3
+ &:last-child
+ color: var(--text-p4)
.related-wrap#comments