mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-22 02:01:32 +08:00
feat: 允许tags不存在
This commit is contained in:
@ -18,7 +18,7 @@ export function sortMDByDate(posts: Array<CollectionEntry<'post'>>) {
|
||||
|
||||
/** Note: This function doesn't filter draft posts, pass it the result of getAllPosts above to do so. */
|
||||
export function getAllTags(posts: Array<CollectionEntry<'post'>>) {
|
||||
return posts.flatMap((post) => [...post.data.tags])
|
||||
return posts.flatMap((post) => [...(post.data?.tags ?? [])])
|
||||
}
|
||||
|
||||
/** Note: This function doesn't filter draft posts, pass it the result of getAllPosts above to do so. */
|
||||
|
Reference in New Issue
Block a user