feat: display author, tags, and reading time on post pages and cards

This commit is contained in:
2026-06-01 21:37:57 -05:00
parent 6888df0c76
commit fac252efa9
2 changed files with 24 additions and 5 deletions

View File

@@ -47,9 +47,19 @@ export default async function PostPage({ params }: { params: Promise<{ slug: str
<h1 className="heading-xl text-ink mt-3 mb-2"> <h1 className="heading-xl text-ink mt-3 mb-2">
{post.title} {post.title}
</h1> </h1>
<p className="font-mono text-xs text-ink-soft"> <div className="flex items-center gap-4 font-mono text-xs text-ink-soft">
{post.readingTime} min read {post.author && <span>by {post.author}</span>}
</p> <span>{post.readingTime} min read</span>
</div>
{post.tags.length > 0 && (
<div className="flex flex-wrap gap-2 mt-4">
{post.tags.map((tag) => (
<span key={tag} className="rounded-full bg-surface px-3 py-1 text-xs font-medium text-ink-soft border border-border">
{tag}
</span>
))}
</div>
)}
</header> </header>
<div className="prose prose-lg max-w-none"> <div className="prose prose-lg max-w-none">
<MDXRemote <MDXRemote

View File

@@ -8,7 +8,7 @@ interface PostCardProps extends PostMeta {
index?: number; index?: number;
} }
export function PostCard({ slug, title, date, excerpt, index = 0 }: PostCardProps) { export function PostCard({ slug, title, date, excerpt, index = 0, tags = [] }: PostCardProps) {
return ( return (
<m.article <m.article
initial={{ opacity: 0, y: 20 }} initial={{ opacity: 0, y: 20 }}
@@ -22,8 +22,17 @@ export function PostCard({ slug, title, date, excerpt, index = 0 }: PostCardProp
<h3 className="heading-md text-ink mt-1 mb-2 hover:text-accent transition-colors"> <h3 className="heading-md text-ink mt-1 mb-2 hover:text-accent transition-colors">
{title} {title}
</h3> </h3>
{tags && tags.length > 0 && (
<div className="flex flex-wrap gap-1 mt-2">
{tags.slice(0, 3).map((tag) => (
<span key={tag} className="rounded bg-surface px-2 py-0.5 text-xs text-ink-soft">
{tag}
</span>
))}
</div>
)}
{excerpt && ( {excerpt && (
<p className="text-ink-soft leading-7">{excerpt}</p> <p className="text-ink-soft leading-7 mt-2">{excerpt}</p>
)} )}
</Link> </Link>
</m.article> </m.article>