From c6d4178fc8d80d1152949ff30b64cd156b729cb1 Mon Sep 17 00:00:00 2001 From: tyx1703 Date: Sat, 13 Jan 2024 12:50:42 +0800 Subject: [PATCH] fix: fixup link related error after configurating base URL (#103) * fix: isActive is not working after configuring base URL * fix: footer links have redundant base URL after configuring base URL --- src/vitepress/components/VPContentDocFooter.vue | 4 ++-- src/vitepress/support/utils.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vitepress/components/VPContentDocFooter.vue b/src/vitepress/components/VPContentDocFooter.vue index cb8c8f4..e361085 100644 --- a/src/vitepress/components/VPContentDocFooter.vue +++ b/src/vitepress/components/VPContentDocFooter.vue @@ -42,7 +42,7 @@ function getFlatSideBarLinks(sidebar: SidebarGroup[]): MenuItemWithLink[] { @@ -53,7 +53,7 @@ function getFlatSideBarLinks(sidebar: SidebarGroup[]): MenuItemWithLink[] { {{ config.i18n?.next ?? 'Next' }} diff --git a/src/vitepress/support/utils.ts b/src/vitepress/support/utils.ts index 617dd96..b991a0e 100644 --- a/src/vitepress/support/utils.ts +++ b/src/vitepress/support/utils.ts @@ -41,7 +41,7 @@ export function isActive( if (matchPath === undefined) { return false } - currentPath = normalize(`/${currentPath}`) + currentPath = withBase(normalize(`/${currentPath}`)) if (asRegex) { return new RegExp(matchPath).test(currentPath) } else {