feat: regularize front-matter, add new-post command

This commit is contained in:
saicaca
2023-10-18 17:31:11 +08:00
parent ad67a86ef9
commit 767d351bd5
15 changed files with 95 additions and 43 deletions

View File

@@ -3,8 +3,8 @@ import {CollectionEntry, getCollection} from "astro:content";
export async function getSortedPosts() {
const allBlogPosts = await getCollection("posts");
const sorted = allBlogPosts.sort((a, b) => {
const dateA = new Date(a.data.pubDate);
const dateB = new Date(b.data.pubDate);
const dateA = new Date(a.data.published);
const dateB = new Date(b.data.published);
return dateA > dateB ? -1 : 1;
});