Files
blog/src/components/PostCard.astro
T
2026-06-18 21:50:53 +08:00

22 lines
562 B
Plaintext

---
import { getCategoryHref, type BlogPost } from '@/lib/posts';
interface Props {
post: BlogPost;
}
const { post } = Astro.props;
---
<article class="post-card">
<a href={post.href}>
<time datetime={post.date.toISOString()}>{post.dateText}</time>
<h2>{post.title}</h2>
{post.summary && <p>{post.summary}</p>}
</a>
<div class="meta-list">
{post.categories.map((category) => <a href={getCategoryHref(category)}>{category}</a>)}
{post.tags.map((tag) => <a href={`/tags/${encodeURIComponent(tag)}/`}>#{tag}</a>)}
</div>
</article>