Fix blog post ordering by using ISO dates in frontmatter

This commit is contained in:
jwinterm
2026-03-10 10:54:00 -04:00
parent 2b9b1bf429
commit cfc5c7265b
7 changed files with 13 additions and 8 deletions
@@ -1,6 +1,6 @@
---
title: "Bauhaus Echo is Live"
date: "March 4, 2026"
date: "2026-03-04"
excerpt: "A visual memory puzzle inspired by Bauhaus design — now on every platform"
---
@@ -1,6 +1,6 @@
---
title: "Crypto Checkout Infrastructure for Multi-Tenant Shops"
date: "March 10, 2026"
date: "2026-03-10"
excerpt: "Non-custodial XMR and WOW checkout, plus Grin via BTCPayServer"
---
@@ -1,6 +1,6 @@
---
title: "Smirk Wallet v0.1.6"
date: "February 6, 2026"
date: "2026-02-06"
excerpt: "Non-custodial social tipping for Telegram and Discord"
---
@@ -1,6 +1,6 @@
---
title: "Website Relaunch"
date: "February 6, 2026"
date: "2026-02-06"
excerpt: "New design, new infrastructure, same focus on quality"
---
+1 -1
View File
@@ -38,7 +38,7 @@ export default async function BlogPost({ params }: Props) {
<div className="glass-card mt-6">
<header className="mb-8 pb-6 border-b border-border">
<time className="text-sm text-muted-foreground">{post.date}</time>
<time className="text-sm text-muted-foreground">{post.dateDisplay}</time>
<h1 className="text-3xl md:text-4xl font-bold mt-2">{post.title}</h1>
{post.excerpt && (
<p className="text-muted-foreground mt-3">{post.excerpt}</p>
+1 -1
View File
@@ -46,7 +46,7 @@ export default function BlogPage() {
{posts.map((post) => (
<Link key={post.slug} href={`/blog/${post.slug}`}>
<Card className="glass-card hover:border-primary/30 transition-colors cursor-pointer">
<time className="text-sm text-muted-foreground">{post.date}</time>
<time className="text-sm text-muted-foreground">{post.dateDisplay}</time>
<h2 className="text-2xl font-bold mt-1 mb-2">{post.title}</h2>
<p className="text-muted-foreground">{post.excerpt}</p>
</Card>
+7 -2
View File
@@ -8,6 +8,7 @@ export type PostMeta = {
slug: string;
title: string;
date: string;
dateDisplay: string;
excerpt: string;
draft: boolean;
};
@@ -26,10 +27,12 @@ export function getAllPosts(): PostMeta[] {
const slug = filename.replace(/\.mdx$/, "");
const raw = fs.readFileSync(path.join(CONTENT_DIR, filename), "utf-8");
const { data } = matter(raw);
const iso = data.date ?? "";
return {
slug,
title: data.title ?? slug,
date: data.date ?? "",
date: iso,
dateDisplay: iso ? new Date(iso + "T12:00:00").toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" }) : "",
excerpt: data.excerpt ?? "",
draft: data.draft === true,
};
@@ -44,10 +47,12 @@ export function getPost(slug: string): Post | null {
const raw = fs.readFileSync(filePath, "utf-8");
const { data, content } = matter(raw);
const iso = data.date ?? "";
return {
slug,
title: data.title ?? slug,
date: data.date ?? "",
date: iso,
dateDisplay: iso ? new Date(iso + "T12:00:00").toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" }) : "",
excerpt: data.excerpt ?? "",
draft: data.draft === true,
content,