--- import { getCollection } from 'astro:content'; import { Card, CardContent, CardDescription, CardHeader } from "@/components/ui/card"; // Fetch all blog posts from the content collection const posts = await getCollection('blog'); // Sort posts by date (newest first) const sortedPosts = posts.sort((a, b) => new Date(b.data.publishDate).getTime() - new Date(a.data.publishDate).getTime() ); const dateFormatter = new Intl.DateTimeFormat('en-GB', { day: '2-digit', month: 'long', year: 'numeric', }); ---

Blog Posts

{sortedPosts.map((post) => (

{post.data.title}

{post.data.description}
{dateFormatter.format(post.data.publishDate)} by {post.data.author}
))}