mirror of
https://github.com/KazooTTT/kazoottt-blog-v2.git
synced 2025-06-24 19:21:31 +08:00
feat: personalize blog and update configurations
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { collectionDateSort } from "@/utils/date";
|
||||
import { type CollectionEntry, getCollection } from "astro:content";
|
||||
|
||||
/** filter out draft posts based on the environment */
|
||||
@ -7,6 +8,14 @@ export async function getAllPosts(): Promise<CollectionEntry<"post">[]> {
|
||||
});
|
||||
}
|
||||
|
||||
export async function getAllCollectionPosts() {
|
||||
const posts = await getAllPosts();
|
||||
const notes = await getCollection("note");
|
||||
const allPosts = [...posts, ...notes];
|
||||
const allPostsSortedByDate = allPosts.sort(collectionDateSort);
|
||||
return allPostsSortedByDate;
|
||||
}
|
||||
|
||||
/** groups posts by year (based on option siteConfig.sortPostsByUpdatedDate), using the year as the key
|
||||
* 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