编译修复
This commit is contained in:
tangly1024
2021-12-20 17:23:25 +08:00
parent c883bbac43
commit 807b0f04ef
5 changed files with 14 additions and 11 deletions

View File

@@ -14,7 +14,10 @@ export default function Tag ({ tags, allPosts, filteredPosts, tag, categories })
}
// 将当前选中的标签置顶🔝
const newTags = [tags.find(r => r.name === tag)].concat(tags.filter(r => r.name !== tag))
if (!tags) tags = []
const currentTag = tags?.find(r => r?.name === tag)
const newTags = currentTag ? [currentTag].concat(tags.filter(r => r?.name !== tag)) : tags.filter(r => r?.name !== tag)
return <BaseLayout meta={meta} tags={tags} currentTag={tag} categories={categories} totalPosts={allPosts}>
<StickyBar>
<TagList tags={newTags} currentTag={tag}/>