feat: manual date takes precedence over git date
This commit is contained in:
parent
97bfb2c3a6
commit
23d34ae3ab
2 changed files with 6 additions and 1 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue