mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-12 07:12:52 +01:00
feat: regularize front-matter, add new-post command
This commit is contained in:
@@ -6,11 +6,11 @@ import I18nKey from "../i18n/i18nKey";
|
||||
|
||||
interface Props {
|
||||
class: string;
|
||||
pubDate: Date;
|
||||
published: Date;
|
||||
tags: string[];
|
||||
categories: string[];
|
||||
}
|
||||
const {pubDate, tags, categories} = Astro.props;
|
||||
const {published, tags, categories} = Astro.props;
|
||||
const className = Astro.props.class;
|
||||
---
|
||||
|
||||
@@ -21,7 +21,7 @@ const className = Astro.props.class;
|
||||
>
|
||||
<Icon name="material-symbols:calendar-today-outline-rounded" class="text-xl"></Icon>
|
||||
</div>
|
||||
<span class="text-black/50 dark:text-white/50 text-sm font-medium">{formatDateToYYYYMMDD(pubDate)}</span>
|
||||
<span class="text-black/50 dark:text-white/50 text-sm font-medium">{formatDateToYYYYMMDD(published)}</span>
|
||||
</div>
|
||||
|
||||
<!-- categories -->
|
||||
@@ -31,7 +31,7 @@ const className = Astro.props.class;
|
||||
<Icon name="material-symbols:menu-rounded" class="text-xl"></Icon>
|
||||
</div>
|
||||
<div class="flex flex-row flex-nowrap">
|
||||
{categories && categories.map(category => <div
|
||||
{(categories && categories.length > 0) && categories.map(category => <div
|
||||
class="with-divider"
|
||||
>
|
||||
<a href=`/archive/category/${category}`
|
||||
@@ -40,7 +40,7 @@ const className = Astro.props.class;
|
||||
{category}
|
||||
</a>
|
||||
</div>)}
|
||||
{!categories && <div class="transition text-black/50 dark:text-white/50 text-sm font-medium">{i18n(I18nKey.uncategorized)}</div>}
|
||||
{!(categories && categories.length > 0) && <div class="transition text-black/50 dark:text-white/50 text-sm font-medium">{i18n(I18nKey.uncategorized)}</div>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -51,7 +51,7 @@ const className = Astro.props.class;
|
||||
<Icon name="material-symbols:tag-rounded" class="text-xl"></Icon>
|
||||
</div>
|
||||
<div class="flex flex-row flex-nowrap">
|
||||
{tags && tags.map(tag => <div
|
||||
{(tags && tags.length > 0) && tags.map(tag => <div
|
||||
class="with-divider"
|
||||
>
|
||||
<a href=`/archive/tag/${tag}`
|
||||
@@ -60,7 +60,7 @@ const className = Astro.props.class;
|
||||
{tag}
|
||||
</a>
|
||||
</div>)}
|
||||
{!tags && <div class="transition text-black/50 dark:text-white/50 text-sm font-medium">{i18n(I18nKey.noTags)}</div>}
|
||||
{!(tags && tags.length > 0) && <div class="transition text-black/50 dark:text-white/50 text-sm font-medium">{i18n(I18nKey.noTags)}</div>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user