diff --git a/theme/src/node/prepare/prepareSidebar.ts b/theme/src/node/prepare/prepareSidebar.ts index 663e4f32..18ac36cb 100644 --- a/theme/src/node/prepare/prepareSidebar.ts +++ b/theme/src/node/prepare/prepareSidebar.ts @@ -235,7 +235,12 @@ function getAllSidebar(): Record { const sidebar = locale === '/' ? (opt.sidebar || options.sidebar) : opt.sidebar locales[locale] = {} for (const [key, value] of entries(sidebar || {})) { - locales[locale][ensureLeadingSlash(key)] = value + locales[locale][ensureLeadingSlash(key)] = isPlainObject(value) && 'items' in value + ? { ...value, prefix: value.prefix?.startsWith('/') ? value.prefix : normalizeLink(locale, removeLeadingSlash(key)) } + : { + items: value, + prefix: normalizeLink(locale, removeLeadingSlash(key)), + } } const collections = rawCollections?.filter(item => item.type === 'doc') if (collections?.length) {