fix: fix nav link href

This commit is contained in:
kaivanwong 2024-05-16 20:10:34 +08:00
parent f3aaa2d9b1
commit cbe8ad7f7b

View file

@ -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}
>
<div>posts:{posts}</div>
<div>path:{path}</div>
<div class="flex flex-col gap-2 sm:flex-row sm:gap-4 flex-wrap mb-8">
{
siteConfig.page.blogLinks.map((nav) => (