This commit is contained in:
MassiveBox 2025-03-17 17:43:53 +01:00
commit d6c414f887
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
97 changed files with 17956 additions and 0 deletions

View file

@ -0,0 +1,18 @@
import type { CollectionEntry } from "astro:content";
import postFilter from "./postFilter";
const getSortedPosts = (posts: CollectionEntry<"blog">[]) => {
return posts
.filter(postFilter)
.sort(
(a, b) =>
Math.floor(
new Date(b.data.modDatetime ?? b.data.pubDatetime).getTime() / 1000
) -
Math.floor(
new Date(a.data.modDatetime ?? a.data.pubDatetime).getTime() / 1000
)
);
};
export default getSortedPosts;