Skip to content

Commit

Permalink
fix: 文章頁分頁不顯示的 bug
Browse files Browse the repository at this point in the history
improvement: 優化部分插件導致文章頁分頁樣式錯亂的 bug
  • Loading branch information
jerryc127 committed Jan 12, 2025
1 parent 3d4bf30 commit 1f3ea55
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "5.3.1",
"version": "5.3.2",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {
Expand Down
22 changes: 16 additions & 6 deletions scripts/filters/random_cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ hexo.extend.generator.register('post', locals => {
previousIndexes.shift()
}

console.log(defaultCover[index])
return defaultCover[index]
}

Expand Down Expand Up @@ -64,9 +63,20 @@ hexo.extend.generator.register('post', locals => {
return data
}

return locals.posts.sort('date').map(post => ({
data: handleImg(post),
layout: 'post',
path: post.path
}))
// https://github.com/hexojs/hexo/blob/master/lib%2Fplugins%2Fgenerator%2Fpost.ts
const posts = locals.posts.sort('date').toArray()
const { length } = posts

return posts.map((post, i) => {
if (i) post.prev = posts[i - 1]
if (i < length - 1) post.next = posts[i + 1]

post.__post = true

return {
data: handleImg(post),
layout: 'post',
path: post.path
}
})
})
9 changes: 6 additions & 3 deletions source/css/_layout/pagination.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
width: 100% !important

.pagination-related
width: 50%
height: 150px

+maxWidth768()
width: 100%
+minWidth768()
flex: 1

.info-1
.info-item-2
Expand All @@ -31,6 +30,10 @@
margin-top: 40px
width: 100%
addBorderRadius()
display: flex

+maxWidth768()
flex-direction: column

.layout
.pagination
Expand Down

0 comments on commit 1f3ea55

Please sign in to comment.