mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-22 10:11:30 +08:00
fix: 修改rss生成逻辑,修改目录生成逻辑
This commit is contained in:
@ -22,6 +22,14 @@ export const getAllDiariesSorted = async (): Promise<CollectionEntry<'post'>[]>
|
||||
return sortMDByDate(await getAllDiaries())
|
||||
}
|
||||
|
||||
|
||||
export const getSortedAllPostsAndDiaries = async (): Promise<CollectionEntry<'post'>[]> => {
|
||||
const posts = await getCollection('post', ({ data }: { data: CollectionEntry<'post'> }) => {
|
||||
return !data.draft
|
||||
})
|
||||
return sortMDByDate(posts)
|
||||
}
|
||||
|
||||
export function sortMDByDate(posts: Array<CollectionEntry<'post'>>): CollectionEntry<'post'>[] {
|
||||
return posts.sort((a, b) => {
|
||||
const aDate = new Date(a.data.date).valueOf()
|
||||
|
Reference in New Issue
Block a user