feat: 显示更新时间

This commit is contained in:
KazooTTT
2025-01-30 21:29:48 +08:00
parent 00121ac82f
commit de99732c19
2 changed files with 11 additions and 7 deletions

View File

@ -13,8 +13,7 @@ interface Props {
const { const {
content: { data, render }, content: { data, render },
simple = false, simple = false
socialImage
} = Astro.props } = Astro.props
const { remarkPluginFrontmatter } = await render() const { remarkPluginFrontmatter } = await render()
--- ---
@ -30,10 +29,8 @@ const { remarkPluginFrontmatter } = await render()
/> />
</div> </div>
) )
} -->{ }
data.draft ? <span class='text-red-500'>(Draft)</span> : null -->
}
<div class='flex flex-wrap items-center gap-x-3 gap-y-2'> <div class='flex flex-wrap items-center gap-x-3 gap-y-2'>
<p class='text-xs'> <p class='text-xs'>
<FormattedDate date={data.date} /> /{' '} <FormattedDate date={data.date} /> /{' '}
@ -49,6 +46,11 @@ const { remarkPluginFrontmatter } = await render()
> >
<Icon name='category' slot='icon' /> <Icon name='category' slot='icon' />
</Label> </Label>
{data.date_modified ? (
<Label title='最新更新' as='div'>
<FormattedDate date={data.date_modified} />
</Label>
) : null}
</> </>
) )
} }

View File

@ -24,7 +24,9 @@ const post = defineCollection({
category: z.string().optional().nullable(), category: z.string().optional().nullable(),
finished: z.boolean().default(false), finished: z.boolean().default(false),
pinned: z.boolean().default(false), pinned: z.boolean().default(false),
projectUrl: z.string().optional() projectUrl: z.string().optional(),
date_created: z.date().optional(),
date_modified: z.date().optional()
}) })
}) })