Skip to content

Commit d6d8ce4

Browse files
author
reco_luan
committed
fix: no need date except for the timeline page
1 parent 88ceaad commit d6d8ce4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

layouts/TimeLines.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default {
5454
// 根据分类获取页面数据
5555
getPages (tag) {
5656
let pages = this.$site.pages
57-
pages = this._filterPostData(pages)
57+
pages = this._filterPostData(pages, true)
5858
// reverse()是为了按时间最近排序排序
5959
this.pages = pages.length == 0 ? [] : pages
6060
for (let i = 0, length = pages.length; i < length; i++) {

mixins/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ export default {
66
const index = Math.floor(Math.random() * tagColorArr.length)
77
return tagColorArr[index]
88
},
9-
_filterPostData (posts) {
9+
_filterPostData (posts, isTimeline) {
1010
posts = posts.filter(item => {
1111
const { home, date, publish } = item.frontmatter
12-
return !(home == true || date === undefined || publish === false)
12+
return isTimeline === true
13+
? !(home == true || date === undefined || publish === false)
14+
: !(home == true || publish === false)
1315
})
1416
return posts
1517
},
@@ -23,4 +25,4 @@ export default {
2325
return parseInt(new Date(date.frontmatter.date).getTime())
2426
}
2527
}
26-
}
28+
}

0 commit comments

Comments
 (0)