Skip to content

Commit a613df4

Browse files
authored
fix: base option not generating correct multi sidebar (#231) (#234)
1 parent 6538c8e commit a613df4

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

src/client/theme-default/Layout.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ const showSidebar = computed(() => {
135135
136136
const { themeConfig } = siteRouteData.value
137137
138-
return !isSideBarEmpty(getSideBarConfig(themeConfig.sidebar, route.path))
138+
return !isSideBarEmpty(
139+
getSideBarConfig(themeConfig.sidebar, route.data.relativePath)
140+
)
139141
})
140142
141143
const toggleSidebar = (to?: boolean) => {

src/client/theme-default/components/SideBarLink.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const SideBarLink: FunctionalComponent<{
1818
const text = props.item.text
1919
const link = resolveLink(site.value.base, props.item.link)
2020
const children = (props.item as DefaultTheme.SideBarGroup).children
21-
const active = isActive(route, link)
21+
const active = isActive(route, props.item.link)
2222
const childItems = createChildren(active, children, headers)
2323

2424
return h('li', { class: 'sidebar-link' }, [

src/client/theme-default/composables/navLink.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function useNavLink(item: Ref<DefaultTheme.NavItemWithLink>) {
1111
const isExternal = isExternalCheck(item.value.link)
1212

1313
const props = computed(() => {
14-
const routePath = normalizePath(route.path)
14+
const routePath = normalizePath(`/${route.data.relativePath}`)
1515

1616
let active = false
1717
if (item.value.activeMatch) {

src/client/theme-default/composables/sideBar.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function useSideBar() {
3030
// now, there's no sidebar setting at frontmatter; let's see the configs
3131
const themeSidebar = getSideBarConfig(
3232
site.value.themeConfig.sidebar,
33-
route.path
33+
route.data.relativePath
3434
)
3535

3636
if (themeSidebar === false) {

src/client/theme-default/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function isActive(route: Route, path?: string): boolean {
2222
return false
2323
}
2424

25-
const routePath = normalize(route.path)
25+
const routePath = normalize(`/${route.data.relativePath}`)
2626
const pagePath = normalize(path)
2727

2828
return routePath === pagePath

0 commit comments

Comments
 (0)