diff --git a/src/components/PostCard.astro b/src/components/PostCard.astro index 5ae303e8..a175f764 100644 --- a/src/components/PostCard.astro +++ b/src/components/PostCard.astro @@ -13,6 +13,7 @@ interface Props { title: string url: string published: Date + updated?: Date tags: string[] category: string image: string @@ -25,6 +26,7 @@ const { title, url, published, + updated, tags, category, image, @@ -54,7 +56,7 @@ const { remarkPluginFrontmatter } = await entry.render() - +
diff --git a/src/components/PostMeta.astro b/src/components/PostMeta.astro index bcc38e8b..3d166ff0 100644 --- a/src/components/PostMeta.astro +++ b/src/components/PostMeta.astro @@ -8,11 +8,13 @@ import { url } from '../utils/url-utils' interface Props { class: string published: Date + updated?: Date tags: string[] category: string hideTagsForMobile?: boolean + hideUpdateDate?: boolean } -const { published, tags, category, hideTagsForMobile = false } = Astro.props +const { published, updated, tags, category, hideTagsForMobile = false, hideUpdateDate = false } = Astro.props const className = Astro.props.class --- @@ -26,6 +28,17 @@ const className = Astro.props.class {formatDateToYYYYMMDD(published)}
+ + {!hideUpdateDate && updated && updated.getTime() !== published.getTime() && ( +
+
+ +
+ {formatDateToYYYYMMDD(updated)} +
+ )} +
- {page.data.map((entry: { data: { draft: boolean; title: string; tags: string[]; category: string; published: Date; image: string; description: string; }; slug: string; }) => { + {page.data.map((entry: { data: { draft: boolean; title: string; tags: string[]; category: string; published: Date; image: string; description: string; updated: Date; }; slug: string; }) => { return (