import { getCollection } from 'astro:content'; import type { CollectionEntry } from 'astro:content'; export function getSortedPosts(posts: CollectionEntry<'blog'>[]) { return [...posts].sort( (a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime(), ); }