Stabilize tag URLs using slugs instead of raw tag text

This commit is contained in:
2025-11-17 18:48:50 +08:00
parent 7c5962485c
commit bede4a2f3e
5 changed files with 32 additions and 16 deletions

View File

@@ -45,7 +45,9 @@ export function PostListItem({ post }: Props) {
{post.tags.slice(0, 4).map((t) => (
<Link
key={t}
href={`/tags/${encodeURIComponent(t)}`}
href={`/tags/${encodeURIComponent(
t.toLowerCase().replace(/\s+/g, '-')
)}`}
className="rounded-full bg-slate-100 px-2 py-0.5 text-[11px] text-slate-600 hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700"
>
#{t}