refactor: move pubDate to date in posts front matter

This commit is contained in:
草师傅 2025-08-11 17:44:56 +08:00
parent 123da1747f
commit b2270003bd
Signed by: gb
GPG key ID: 43330A030E2D6478
15 changed files with 21 additions and 22 deletions

View file

@ -5,8 +5,7 @@ export const posts = ({ image }) => z.object({
title: z.string(),
description: z.string(),
summary: z.string().optional(),
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
date: z.coerce.date(),
categories: z.array(z.string()).default(['uncategorized']),
tags: z.array(z.string()).optional(),
cover: image().optional(),

View file

@ -1,7 +1,7 @@
---
title: 'First Post'
description: 'Welcome to my terminal blog'
pubDate: '2025-06-01'
date: '2025-06-01'
---
Hello world! This is the first post on my new terminal blog.

View file

@ -1,6 +1,6 @@
---
title: "Markdown Syntax Example"
pubDate: '2023-07-15T12:00:00Z'
date: '2023-07-15T12:00:00Z'
description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements."
tags: ["markdown", "css", "html", "sample"]
---
@ -98,9 +98,9 @@ This most simple one can be used like this:
<LinkCard url="https://astro.build"/>
```
or with a archive link:
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.pubDate} updatedDate={frontmatter.updatedDate} />
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.date} updatedDate={frontmatter.updatedDate} />
```mdx
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.pubDate} updatedDate={frontmatter.updatedDate} />
<LinkCard url="https://astro.build" showArchive="true" pubDate={frontmatter.date} updatedDate={frontmatter.updatedDate} />
```
<Callout type="info">
The `pubDate` or `updatedDate` props is optional, but in order to make the component to display the archived version around the date correctly, they should be passed.

View file

@ -2,7 +2,7 @@
title: 'The Art of Minimalism'
description: 'Thoughts on minimalism in design and code'
summary: 'Exploring the principles of minimalism and its application in design and coding practices.'
pubDate: '2025-06-05'
date: '2025-06-05'
author: 'Wheatley'
tags:
- 'design'

View file

@ -1,7 +1,7 @@
---
title: 'My Terminal Setup'
description: 'A walkthrough of my current terminal configuration'
pubDate: '2025-06-08'
date: '2025-06-08'
author:
- 'Glados'
- 'Wheatley'