From 77b0f69d0c6e555349dd491d7ca209924d119e61 Mon Sep 17 00:00:00 2001 From: Matt Kosarek Date: Wed, 11 Mar 2026 17:49:05 -0400 Subject: Migrate to astro --- src/pages/posts/index.astro | 88 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/pages/posts/index.astro (limited to 'src/pages/posts/index.astro') diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro new file mode 100644 index 0000000..b3ea740 --- /dev/null +++ b/src/pages/posts/index.astro @@ -0,0 +1,88 @@ +--- +import { getCollection, type CollectionEntry } from 'astro:content'; +import BaseLayout from '../../layouts/BaseLayout.astro'; +import '../../styles/post.css'; +import '../../styles/sitemap.css'; + +const allPosts = await getCollection('posts'); +allPosts.sort((a: CollectionEntry<'posts'>, b: CollectionEntry<'posts'>) => b.data.date.localeCompare(a.data.date)); + +function formatDate(dateStr: string): string { + const [year, month, day] = dateStr.split('-').map(Number); + const d = new Date(year, month - 1, day); + return d.toLocaleDateString('en-US', { month: 'long', day: '2-digit', year: 'numeric' }); +} +--- + + +
+

+ RSS Feed +
+ +
+ +
+
    + {allPosts.map((post: CollectionEntry<'posts'>) => ( +
  • +

    {post.data.title}

    +

    {formatDate(post.data.date)}

    +

    {post.data.tags.join(',')}

    +
  • + ))} +
+
+ + +
-- cgit v1.2.1