diff --git a/src/components/widget/TOC.astro b/src/components/widget/TOC.astro index 9a3977b9..608de571 100644 --- a/src/components/widget/TOC.astro +++ b/src/components/widget/TOC.astro @@ -1,6 +1,7 @@ --- import type { MarkdownHeading } from "astro"; import { siteConfig } from "../../config"; +import { url } from "../../utils/url-utils"; interface Props { class?: string; @@ -15,8 +16,7 @@ for (const heading of headings) { } const className = Astro.props.class; - -const isPostsRoute = Astro.url.pathname.startsWith("/posts/"); +const isPostsRoute = Astro.url.pathname.startsWith(url("/posts/")); const removeTailingHash = (text: string) => { let lastIndexOfHash = text.lastIndexOf("#");