From 3e7086bb3dbca0e3a5c61244957ab7b7d5208d71 Mon Sep 17 00:00:00 2001 From: rzen Date: Tue, 5 May 2026 17:53:25 -0400 Subject: [PATCH] site: blog index as title/intro teasers --- src/pages/blog.astro | 80 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/src/pages/blog.astro b/src/pages/blog.astro index 3743c08..b544cd1 100644 --- a/src/pages/blog.astro +++ b/src/pages/blog.astro @@ -1,7 +1,6 @@ --- +import { getCollection } from 'astro:content'; import BaseLayout from '../layouts/BaseLayout.astro'; -import EntryList from '../components/EntryList.astro'; -import { getAllEntries } from '../lib/entries'; import { buildOgImage, buildBreadcrumbs, @@ -9,14 +8,23 @@ import { absoluteUrl, } from '../lib/seo'; -const posts = (await getAllEntries()).filter((e) => e.type === 'post'); -const lastUpdated = posts[0]?.date; +const posts = (await getCollection('posts')).sort( + (a, b) => b.data.date.valueOf() - a.data.date.valueOf() +); +const lastUpdated = posts[0]?.data.date; + +const fmt = new Intl.DateTimeFormat('en-US', { + year: 'numeric', + month: 'short', + day: 'numeric', + timeZone: 'UTC', +}); const description = 'Longer-form notes from Unique — essays and meta about the project.'; const ogImage = buildOgImage(undefined, 'posts', 'Unique blog'); const itemList = buildItemList( - posts.map((p) => ({ url: p.href, name: p.primary })), + posts.map((p) => ({ url: `/posts/${p.id}/`, name: p.data.title })), 'Posts on Unique' ); @@ -45,12 +53,72 @@ const breadcrumbs = buildBreadcrumbs([ jsonLd={[blogSchema, itemList, breadcrumbs]} > {posts.length > 0 ? ( - + ) : (

Nothing yet — check back soon.

)}