From 576c309aea6b190c213e7910a6b665fc22d03507 Mon Sep 17 00:00:00 2001 From: kaivanwong Date: Thu, 16 May 2024 18:47:03 +0800 Subject: [PATCH] fix: fix the pathname --- src/pages/blog/[...path].astro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/blog/[...path].astro b/src/pages/blog/[...path].astro index b5aa3ca..228f4b3 100644 --- a/src/pages/blog/[...path].astro +++ b/src/pages/blog/[...path].astro @@ -17,6 +17,10 @@ export async function getStaticPaths() { const { path } = Astro.params const posts = await getPosts(path) + +function activeLink(pathname: string) { + return Astro.url.pathname.replace(/\/+/g, '/').replace(/\/$/, '') === pathname +} --- ( {nav.text}