Skip to content

Commit

Permalink
feat: make keep reading never empty
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <[email protected]>
  • Loading branch information
shanghaikid committed Feb 10, 2025
1 parent 5d69ac6 commit ae0e5e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/localization/CreateBlogDetailProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ export const createBlogDetailProps = (lang: LanguageEnum) => {
})
: { ...metaData, tree: content };

const moreBlogs = allData
.filter(v => v.tags.some(tag => tags.includes(tag) && v.id !== id))
.slice(0, 4);

return {
props: {
locale: lang,
newHtml,
anchorList: anchorList.filter(item => item.label !== rest.title),
codeList,
moreBlogs: allData
.filter(v => v.tags.some(tag => tags.includes(tag) && v.id !== id))
.slice(0, 4),
moreBlogs: moreBlogs.length
? moreBlogs
: allData.filter(item => item.id !== id).slice(0, 4),
tags,
...rest,
},
Expand Down

0 comments on commit ae0e5e6

Please sign in to comment.