diff --git a/website/src/components/BlogFeed.astro b/website/src/components/BlogFeed.astro index af72db4..525d7ba 100644 --- a/website/src/components/BlogFeed.astro +++ b/website/src/components/BlogFeed.astro @@ -12,29 +12,18 @@ const { headingLevel = 2, hideAuthor = false } = Astro.props; const posts = (await getCollection('blog')).filter((post) => !post.data.hidden); const distinctYears: number[] = posts - .map(post => post.data.pubDate.year) + .map(post => post.data.pubDate.getFullYear()) .reduce((acc, curr) => acc.includes(curr) ? acc : [...acc, curr], []) .sort((a, b) => b - a); function matchesYear(year: number) { - return (post: CollectionEntry<'blog'>) => post.data.pubDate.year === year; + return (post: CollectionEntry<'blog'>) => post.data.pubDate.getFullYear() === year; } function sortByPubDateDescending(post1: CollectionEntry<'blog'>, post2: CollectionEntry<'blog'>) { - const year1 = post1.data.pubDate.year; - const year2 = post2.data.pubDate.year; - const month1 = post1.data.pubDate.month; - const month2 = post2.data.pubDate.month; - const day1 = post1.data.pubDate.day; - const day2 = post2.data.pubDate.day; - - if (year1 !== year2) { - return year2 - year1; - } else if (month1 !== month2) { - return month2 - month1; - } else { - return day2 - day1; - } + const date1 = post1.data.pubDate.getMilliseconds(); + const date2 = post2.data.pubDate.getMilliseconds(); + return date2 - date1; } const headingElem = `h${headingLevel}`; diff --git a/website/src/content/blog/2024/01/14/sapiens_on_religion.md b/website/src/content/blog/2024/01/14/sapiens_on_religion.md index b484557..871c7af 100644 --- a/website/src/content/blog/2024/01/14/sapiens_on_religion.md +++ b/website/src/content/blog/2024/01/14/sapiens_on_religion.md @@ -3,10 +3,7 @@ title: Harari’s Sapiens on Religion description: >- In which I discuss why I think Harari’s characterisation of religion is inadequate because it’s too materialistic. -pubDate: - year: 2024 - month: 01 - day: 14 +pubDate: 2024-01-14 --- I’ve been slowly re-reading Yuval Noah Harari’s 2014 classic, diff --git a/website/src/content/blog/2024/01/29/euhwc_toast_to_the_lasses_2024.md b/website/src/content/blog/2024/01/29/euhwc_toast_to_the_lasses_2024.md index dd456f0..dec6bf5 100644 --- a/website/src/content/blog/2024/01/29/euhwc_toast_to_the_lasses_2024.md +++ b/website/src/content/blog/2024/01/29/euhwc_toast_to_the_lasses_2024.md @@ -6,10 +6,7 @@ description: >- Ullapool last weekend, I had the last privilege of giving the Toast to the Lassies. Particularly for the benefit of those who weren’t there, here it is in full! -pubDate: - year: 2024 - month: 01 - day: 29 +pubDate: 2024-01-29 --- Had Burns, instead of his sweet bonnie Jean,
diff --git a/website/src/content/blog/2024/03/30/easter.md b/website/src/content/blog/2024/03/30/easter.md index 9735220..f0bd3b2 100644 --- a/website/src/content/blog/2024/03/30/easter.md +++ b/website/src/content/blog/2024/03/30/easter.md @@ -4,10 +4,7 @@ description: >- Based on a talk given to my colleagues at Scott Logic for Maundy Thursday, 2024. -pubDate: - year: 2024 - month: 03 - day: 30 +pubDate: 2024-03-30 --- As you might have noticed, it is Easter this week! So I'd like to take five or diff --git a/website/src/content/blog/2024/04/11/who_consecrates_the_temple.md b/website/src/content/blog/2024/04/11/who_consecrates_the_temple.md index 1364f5e..74273c2 100644 --- a/website/src/content/blog/2024/04/11/who_consecrates_the_temple.md +++ b/website/src/content/blog/2024/04/11/who_consecrates_the_temple.md @@ -1,10 +1,7 @@ --- title: Who consecrates the tabernacle? (Ex 29) description: A quick, cursory and possibly completely rubbish observation I've made on Exodus 29. -pubDate: - year: 2024 - month: 04 - day: 11 +pubDate: 2024-04-11 --- I've been reading Exodus recently, and the ending of Chapter 29 stuck out to me. diff --git a/website/src/content/blog/2024/04/14/god_is_not_great.md b/website/src/content/blog/2024/04/14/god_is_not_great.md index bf47b27..7b923c0 100644 --- a/website/src/content/blog/2024/04/14/god_is_not_great.md +++ b/website/src/content/blog/2024/04/14/god_is_not_great.md @@ -3,10 +3,7 @@ title: God Is Not Great, initial thoughts description: >- My spark notes on Hitchen's classic 2007 polemic against religion, plus some initial thoughts on how I want to respond to it. -pubDate: - year: 2024 - month: 04 - day: 14 +pubDate: 2024-04-14 --- These are my 'spark notes' on _God Is Not Great_, Christopher Hitchen's classic diff --git a/website/src/content/blog/2024/05/02/no_more_youtube.md b/website/src/content/blog/2024/05/02/no_more_youtube.md index d696936..4665245 100644 --- a/website/src/content/blog/2024/05/02/no_more_youtube.md +++ b/website/src/content/blog/2024/05/02/no_more_youtube.md @@ -2,10 +2,7 @@ title: How I made YouTube work for me description: >- I just learned YouTube channels have an RSS feed. This is terrific news. -pubDate: - year: 2024 - month: 05 - day: 02 +pubDate: 2024-05-02 --- One of my bad habits in life is wandering through YouTube. I've always had diff --git a/website/src/content/blog/2024/06/13/llms_do_not_understand_anything.md b/website/src/content/blog/2024/06/13/llms_do_not_understand_anything.md index 004234a..9598843 100644 --- a/website/src/content/blog/2024/06/13/llms_do_not_understand_anything.md +++ b/website/src/content/blog/2024/06/13/llms_do_not_understand_anything.md @@ -2,10 +2,7 @@ title: LLMs do not understand anything description: >- Save this for the next time someone tells you that LLMs 'understand' things. -pubDate: - year: 2024 - month: 06 - day: 13 +pubDate: 2024-06-13 --- LLMs do not understand what they are talking about. They just don't. It's not diff --git a/website/src/content/blog/2024/07/08/doctor_who_gayness_church.md b/website/src/content/blog/2024/07/08/doctor_who_gayness_church.md index 60749c4..40c1b2e 100644 --- a/website/src/content/blog/2024/07/08/doctor_who_gayness_church.md +++ b/website/src/content/blog/2024/07/08/doctor_who_gayness_church.md @@ -3,10 +3,7 @@ title: Doctor Who, Gayness, and the Church description: >- Series 14 of Doctor Who has a schizophrenic relationship with Christianity. It’s also gay. I think there might be a connection. -pubDate: - year: 2024 - month: 07 - day: 8 +pubDate: 2024-07-08 --- I’ve recently finished the most recent series of Doctor Who, series fourteen (or diff --git a/website/src/content/config.ts b/website/src/content/config.ts index 8bcd92d..dfdf403 100644 --- a/website/src/content/config.ts +++ b/website/src/content/config.ts @@ -1,19 +1,13 @@ import { defineCollection, z } from 'astro:content'; -const dateSchema = z.object({ - year: z.number(), - month: z.number(), - day: z.number(), -}); - const blog = defineCollection({ type: 'content', schema: z.object({ title: z.string(), hidden: z.optional(z.boolean()), description: z.string(), - pubDate: dateSchema, - updatedDate: z.optional(dateSchema), + pubDate: z.date(), + updatedDate: z.optional(z.date()), }), }); diff --git a/website/src/layouts/BlogPost.astro b/website/src/layouts/BlogPost.astro index 8639caa..3f7a999 100644 --- a/website/src/layouts/BlogPost.astro +++ b/website/src/layouts/BlogPost.astro @@ -9,11 +9,6 @@ type Props = CollectionEntry<'blog'>['data']; const { title, description, pubDate, updatedDate } = Astro.props; const canonicalUrl = new URL(Astro.url.pathname, Astro.site); - -const pubDateStr = `${pubDate.year}-${pubDate.month}-${pubDate.day}`; -const updatedDateStr = updatedDate ? - `${updatedDate.year}-${updatedDate.month}-${updatedDate.day}` - : pubDateStr; --- @@ -32,9 +27,9 @@ const updatedDateStr = updatedDate ? { updatedDate ? ( - Updated: . - Originally published: . - ) : Published: . + Updated: . + Originally published: . + ) : Published: . } diff --git a/website/src/pages/blog/rss.xml.ts b/website/src/pages/blog/rss.xml.ts index 9e65a04..afd0640 100644 --- a/website/src/pages/blog/rss.xml.ts +++ b/website/src/pages/blog/rss.xml.ts @@ -26,7 +26,7 @@ export async function GET(context: APIContext) { link: `/blog/${post.slug}`, title: post.data.title, content: mdParser.render(post.body), - pubDate: new Date(`${post.data.pubDate.year}-${post.data.pubDate.month}-${post.data.pubDate.day}`), + pubDate: post.data.pubDate, description: post.data.description, author: 'Joe Carstairs', diff --git a/website/src/src/content/blog/2024/04/10/tracking_pixels.md b/website/src/src/content/blog/2024/04/10/tracking_pixels.md index 15ccc55..cb2e965 100644 --- a/website/src/src/content/blog/2024/04/10/tracking_pixels.md +++ b/website/src/src/content/blog/2024/04/10/tracking_pixels.md @@ -1,10 +1,7 @@ --- title: Tracking pixels description: Concerning a notice in the privacy policy of an HR app -pubDate: - year: 2024 - month: 04 - day: 10 +pubDate: 2024-04-10 --- I recently made the mistake of reading the privacy policy of the HR app my