--- import { getCollection } from 'astro:content'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } 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() ); ---

Blog Posts

{sortedPosts.map((post) => ( {post.data.title} {post.data.description}
{post.data.publishDate.toLocaleDateString()} by {post.data.author}
))}