From c2ad94b04f290b5197a1cc80c98015be9e7b25da Mon Sep 17 00:00:00 2001 From: IwanIDev Date: Sat, 21 Mar 2026 13:47:35 +0000 Subject: feat: add blog post listing and UI components for the blog --- src/components/BlogPosts.astro | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/components/BlogPosts.astro (limited to 'src/components/BlogPosts.astro') diff --git a/src/components/BlogPosts.astro b/src/components/BlogPosts.astro new file mode 100644 index 0000000..54b7529 --- /dev/null +++ b/src/components/BlogPosts.astro @@ -0,0 +1,34 @@ +--- +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

+ +
\ No newline at end of file -- cgit