diff --git a/src/components/PostCard.astro b/src/components/PostCard.astro index 56ed8c0..a7a7143 100644 --- a/src/components/PostCard.astro +++ b/src/components/PostCard.astro @@ -1,13 +1,12 @@ --- -import path from "node:path"; import type { CollectionEntry } from "astro:content"; +import path from "node:path"; import { Icon } from "astro-icon/components"; import I18nKey from "../i18n/i18nKey"; import { i18n } from "../i18n/translation"; import { getDir } from "../utils/url-utils"; -import PostMetadata from "./PostMeta.astro"; import ImageWrapper from "./misc/ImageWrapper.astro"; -import { umamiConfig } from "../config"; +import PostMetadata from "./PostMeta.astro"; interface Props { class?: string; @@ -17,7 +16,7 @@ interface Props { published: Date; updated?: Date; tags: string[]; - category: string; + category: string | null; image: string; description: string; draft: boolean; @@ -35,8 +34,6 @@ const { description, style, } = Astro.props; - -const isPinned = entry.data.pinned === true; const className = Astro.props.class; const hasCover = image !== undefined && image !== null && image !== ""; @@ -54,11 +51,6 @@ const { remarkPluginFrontmatter } = await entry.render(); before:w-1 before:h-5 before:rounded-md before:bg-[var(--primary)] before:absolute before:top-[35px] before:left-[18px] before:hidden md:before:block "> - {isPinned && ( - - 置顶 - - )} {title} @@ -72,14 +64,14 @@ const { remarkPluginFrontmatter } = await entry.render(); { description || remarkPluginFrontmatter.excerpt } - +
-
{remarkPluginFrontmatter.words} {" " + i18n(I18nKey.wordsCount)}
-
|
-
{remarkPluginFrontmatter.minutes} {" " + i18n(I18nKey.minutesCount)}
+
+ {remarkPluginFrontmatter.words} {" " + i18n(remarkPluginFrontmatter.words === 1 ? I18nKey.wordCount : I18nKey.wordsCount)} +
|
- 加载中... + {remarkPluginFrontmatter.minutes} {" " + i18n(remarkPluginFrontmatter.minutes === 1 ? I18nKey.minuteCount : I18nKey.minutesCount)}
@@ -91,7 +83,6 @@ const { remarkPluginFrontmatter } = await entry.render(); "md:w-[var(--coverWidth)] relative md:absolute md:top-3 md:bottom-3 md:right-3 rounded-xl overflow-hidden active:scale-95" ]} >
-
@@ -115,67 +106,5 @@ const { remarkPluginFrontmatter } = await entry.render();
- - \ No newline at end of file + diff --git a/src/components/PostMeta.astro b/src/components/PostMeta.astro index 2e8070e..488e85e 100644 --- a/src/components/PostMeta.astro +++ b/src/components/PostMeta.astro @@ -2,19 +2,17 @@ import { Icon } from "astro-icon/components"; import I18nKey from "../i18n/i18nKey"; import { i18n } from "../i18n/translation"; -import { getDir, url } from "../utils/url-utils"; import { formatDateToYYYYMMDD } from "../utils/date-utils"; -import { umamiConfig } from "../config"; +import { getCategoryUrl, getTagUrl } from "../utils/url-utils"; interface Props { class: string; published: Date; updated?: Date; tags: string[]; - category: string; + category: string | null; hideTagsForMobile?: boolean; hideUpdateDate?: boolean; - slug?: string; } const { published, @@ -23,7 +21,6 @@ const { category, hideTagsForMobile = false, hideUpdateDate = false, - slug, } = Astro.props; const className = Astro.props.class; --- @@ -56,7 +53,7 @@ const className = Astro.props.class;
- {category || i18n(I18nKey.uncategorized)} @@ -73,79 +70,13 @@ const className = Astro.props.class;
{(tags && tags.length > 0) && tags.map((tag, i) => (
/
-
- {tag} + {tag.trim()} ))} {!(tags && tags.length > 0) &&
{i18n(I18nKey.noTags)}
}
- - - {slug && ( -
-
- -
- 加载中... -
- )} - - -{slug && ( - -)} \ No newline at end of file + \ No newline at end of file