From cbe8ad7f7b1f01d87c9344da0b2e694701c80771 Mon Sep 17 00:00:00 2001 From: kaivanwong Date: Thu, 16 May 2024 20:10:34 +0800 Subject: [PATCH] fix: fix nav link href --- 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 228f4b3..2813405 100644 --- a/src/pages/blog/[...path].astro +++ b/src/pages/blog/[...path].astro @@ -8,7 +8,9 @@ export async function getStaticPaths() { const paths = siteConfig.page.blogLinks.map((nav) => { const href = nav.href.replace('/blog', '') return { - params: { path: href === '' ? undefined : href }, + params: { + path: href === '' ? undefined : href.replace(/^\/+|\/+$/g, ''), + }, } }) return paths @@ -29,6 +31,8 @@ function activeLink(pathname: string) { pageNav={true} pageOperate={true} > +
posts:{posts}
+
path:{path}
{ siteConfig.page.blogLinks.map((nav) => (