From df12debd4c9bc557f8308cf78c90870e5a0804e4 Mon Sep 17 00:00:00 2001 From: lew Date: Sat, 31 Jan 2026 00:04:54 +0000 Subject: [PATCH] feat: corrects md to use a manual slug --- www/src/content.config.ts | 1 + www/src/pages/md/[slug].astro | 2 +- www/src/pages/md/index.astro | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/www/src/content.config.ts b/www/src/content.config.ts index 98e79d4..bea154a 100644 --- a/www/src/content.config.ts +++ b/www/src/content.config.ts @@ -11,6 +11,7 @@ const posts = defineCollection({ pinned: z.boolean().optional(), category: z.string().optional(), draft: z.boolean().optional(), + slug: z.string(), }) }); diff --git a/www/src/pages/md/[slug].astro b/www/src/pages/md/[slug].astro index 1209de4..af1d28c 100644 --- a/www/src/pages/md/[slug].astro +++ b/www/src/pages/md/[slug].astro @@ -5,7 +5,7 @@ import Layout from '../../layouts/Layout.astro'; export async function getStaticPaths() { const posts = await getCollection('posts', ({ data }) => data.draft !== true); return posts.map(post => ({ - params: { slug: post.id }, + params: { slug: post.data.slug }, props: { post } })); } diff --git a/www/src/pages/md/index.astro b/www/src/pages/md/index.astro index 210a4a1..269eb22 100644 --- a/www/src/pages/md/index.astro +++ b/www/src/pages/md/index.astro @@ -40,7 +40,7 @@ function formatDate(date: Date): string { {sortedCategories.map(category => (
{category} -
 `${formatDate(post.data.date)}    ${post.data.title}${post.data.pinned ? ' [pinned]' : ''}`).join('\n')} />
+
 `${formatDate(post.data.date)}    ${post.data.title}${post.data.pinned ? ' [pinned]' : ''}`).join('\n')} />
 
))}