diff --git a/src/utils/getSortedPosts.ts b/src/utils/getSortedPosts.ts index d38f6a7..f14d963 100644 --- a/src/utils/getSortedPosts.ts +++ b/src/utils/getSortedPosts.ts @@ -1,13 +1,12 @@ -import type { MarkdownInstance } from "astro"; -import type { Frontmatter } from "../types"; +import type { CollectionEntry } from "astro:content"; -const getSortedPosts = (posts: MarkdownInstance[]) => +const getSortedPosts = (posts: CollectionEntry<"blog">[]) => posts - .filter(({ frontmatter }) => !frontmatter.draft) + .filter(({ data }) => !data.draft) .sort( (a, b) => - Math.floor(new Date(b.frontmatter.datetime).getTime() / 1000) - - Math.floor(new Date(a.frontmatter.datetime).getTime() / 1000) + Math.floor(new Date(b.data.publishDatetime).getTime() / 1000) - + Math.floor(new Date(a.data.publishDatetime).getTime() / 1000) ); export default getSortedPosts;