diff --git a/pages/src/components/Card.tsx b/pages/src/components/Card.tsx index 5c42792..2c6ed1b 100644 --- a/pages/src/components/Card.tsx +++ b/pages/src/components/Card.tsx @@ -29,6 +29,11 @@ const parseBody = (body: string, href: string) => { return marked_content + end; } +// 定义一个函数,解析20240428格式为2024-04-28 +const parseDate = (date: string) => { + return date.substring(0, 4) + "-" + date.substring(4, 6) + "-" + date.substring(6, 8); +} + export interface Props { id?: string; href?: string; @@ -42,6 +47,7 @@ export default function Card({ id, href, frontmatter, secHeading = true, body, p const { title, status, + published_date } = frontmatter; const headerProps = { @@ -76,6 +82,7 @@ export default function Card({ id, href, frontmatter, secHeading = true, body, p ) )} +

{parseDate(published_date.toString())}

{ status === 'collected' &&
{body && body.split(/\s/g).length} 词 @@ -87,8 +94,8 @@ export default function Card({ id, href, frontmatter, secHeading = true, body, p {/* */}
{publishCard && - // 去掉段后间隔 -
+ // 去掉段后间隔,设置max-width为100% +
{/* 注意需要my-0否则继承 */}

diff --git a/pages/src/layouts/Posts.astro b/pages/src/layouts/Posts.astro index b6c1220..ce318b6 100644 --- a/pages/src/layouts/Posts.astro +++ b/pages/src/layouts/Posts.astro @@ -61,7 +61,13 @@ const countData = getStatusCount(await getCollection("posts")); }