fix: sanitize post title for valid CSS view-transition-name (#650)

This commit is contained in:
せいはな
2026-06-02 23:05:23 +08:00
committed by GitHub
parent e062c79248
commit 470bfb528e
3 changed files with 30 additions and 3 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
---
import type { CollectionEntry } from "astro:content";
import { getPostUrl } from "@/utils/getPostPaths";
import { slugifyStr } from "@/utils/slugify";
import { toTransitionName } from "@/utils/toTransitionName";
import Datetime from "./Datetime.astro";
type Props = {
@@ -22,7 +22,7 @@ const { title, description, ...props } = data;
"focus-visible:no-underline focus-visible:underline-offset-0",
]}
>
<Heading transition:name={slugifyStr(title.replaceAll(".", "-"))}>
<Heading transition:name={toTransitionName(title)}>
{title}
</Heading>
</a>