diff --git a/docs/.vuepress/notes.ts b/docs/.vuepress/notes.ts index d1e0f6fe..4dc04907 100644 --- a/docs/.vuepress/notes.ts +++ b/docs/.vuepress/notes.ts @@ -107,7 +107,6 @@ export const zhNotes = definePlumeNotesConfig({ sidebar: [ { text: '插件', - link: '/plugins/', items: [ 'caniuse', 'iconify', @@ -117,7 +116,7 @@ export const zhNotes = definePlumeNotesConfig({ { text: 'plugin-netlify-functions', dir: 'netlify-functions', - link: '/plugins/plugin-netlify-functions/', + link: '/plugin-netlify-functions/', items: [ '介绍', '使用', @@ -137,7 +136,6 @@ export const zhNotes = definePlumeNotesConfig({ { text: '工具', icon: 'tabler:tools', - link: '/tools/', items: ['home-hero-tint-plate', 'caniuse'], }, ], diff --git a/docs/notes/plugins/netlify-functions/测试文件.md b/docs/notes/plugins/netlify-functions/测试文件.md deleted file mode 100644 index f19648dd..00000000 --- a/docs/notes/plugins/netlify-functions/测试文件.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: 测试文件 -author: Plume Theme -createTime: 2024/05/26 02:11:27 -permalink: /plugins/9kekfblc/ ---- diff --git a/theme/src/node/plugins/resolveAutoFrontmatterOptions.ts b/theme/src/node/plugins/resolveAutoFrontmatterOptions.ts index caf98f2c..646890c4 100644 --- a/theme/src/node/plugins/resolveAutoFrontmatterOptions.ts +++ b/theme/src/node/plugins/resolveAutoFrontmatterOptions.ts @@ -115,11 +115,11 @@ export function resolveAutoFrontmatterOptions( return const locale = resolveLocale(relativePath) - const notes = notesByLocale(locale) + const prefix = notesByLocale(locale)?.link || '' const note = findNote(relativePath) return pathJoin( locale, - notes?.link || '', + prefix, note?.link || getCurrentDirname(note?.dir, relativePath), '/', ) @@ -160,9 +160,12 @@ export function resolveAutoFrontmatterOptions( const sidebar = note?.sidebar if (note && sidebar && sidebar !== 'auto') { - const res = resolveLinkBySidebar(sidebar, pathJoin(prefix, note.dir || '')) + const res = resolveLinkBySidebar(sidebar, pathJoin(notes?.dir || '', note.dir || '')) const file = ensureLeadingSlash(relativePath) - res[file] && args.push(res[file]) + if (res[file]) + args.push(res[file]) + else + res[path.dirname(file)] && args.push(res[path.dirname(file)]) } return pathJoin(...args, nanoid(), '/') @@ -231,6 +234,7 @@ function SidebarLink(items: NotesSidebar | undefined, link: string, text: string res[pathJoin(dir, 'index.md')] = link res[pathJoin(dir, 'readme.md')] = link } + res[dir] = link } else { const { dir: subDir = '', link: subLink = '/', items: subItems, text: subText = '' } = item