From 23d34ae3abf7ed7f3c44b49a7a1ee04cc6ad9668 Mon Sep 17 00:00:00 2001 From: lew Date: Sat, 31 Jan 2026 23:59:24 +0000 Subject: [PATCH] feat: manual date takes precedence over git date --- www/src/content.config.ts | 1 + www/src/lib/md.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/www/src/content.config.ts b/www/src/content.config.ts index 5836c2c..a1e3299 100644 --- a/www/src/content.config.ts +++ b/www/src/content.config.ts @@ -7,6 +7,7 @@ const md = defineCollection({ loader: glob({ pattern: '**/*.md', base: './src/content/md' }), schema: z.object({ title: z.string(), + date: z.coerce.date().optional(), pinned: z.boolean().optional(), category: z.string().optional(), draft: z.boolean().optional(), diff --git a/www/src/lib/md.ts b/www/src/lib/md.ts index 4695519..da1c497 100644 --- a/www/src/lib/md.ts +++ b/www/src/lib/md.ts @@ -19,9 +19,13 @@ function getPostFilePath(post: Post): string { export function enrichPostWithDates(post: Post): PostWithDates { const filePath = getPostFilePath(post); + const gitDates = getGitDates(filePath); return { ...post, - dates: getGitDates(filePath), + dates: { + created: post.data.date ?? gitDates.created, + updated: gitDates.updated, + }, }; }