feat: add post update date (#243)
* feat: Add article update date * feat: 1.Hide update time on the homepage; 2.Replace update icon; * remove iconify-json/mdi --------- Co-authored-by: liangjianhao <jianhao.liang@sz-sanjiang.com>
This commit is contained in:
1 parent
079abbc965
commit
b604cdf18c
6 files changed
+22
-3
No files matched your search
@@ -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
|
||||
<span class="text-50 text-sm font-medium">{formatDateToYYYYMMDD(published)}</span>
|
||||
</div>
|
||||
|
||||
<!-- update date -->
|
||||
{!hideUpdateDate && updated && updated.getTime() !== published.getTime() && (
|
||||
<div class="flex items-center">
|
||||
<div class="meta-icon"
|
||||
>
|
||||
<Icon name="material-symbols:edit-calendar-outline-rounded" class="text-xl"></Icon>
|
||||
</div>
|
||||
<span class="text-50 text-sm font-medium">{formatDateToYYYYMMDD(updated)}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<!-- categories -->
|
||||
<div class="flex items-center">
|
||||
<div class="meta-icon"
|
||||
|
||||
Reference in new issue
Block a user