fix(theme): normalize blog&category path

This commit is contained in:
pengzhanbo 2023-06-30 01:38:51 +08:00
parent 57872ce288
commit 7d12839838
2 changed files with 5 additions and 2 deletions

View File

@ -39,7 +39,9 @@ export const setupPlugins = (
const localeNotesDirs = Object.keys(locales)
.map((locale) => {
const dir = locales[locale].notes?.dir || ''
return dir ? path.join(locale, dir, '**').replace(/^\//, '') : ''
return dir
? path.join(locale, dir, '**').replace(/\\+/g, '/').replace(/^\//, '')
: ''
})
.filter(Boolean)

View File

@ -43,7 +43,8 @@ export function autoCategory(
const notesLinks: string[] = []
for (const [, locale] of locales.entries()) {
const notes = options.locales?.[locale]?.notes
if (notes && notes.link) notesLinks.push(path.join(locale, notes.link))
if (notes && notes.link)
notesLinks.push(path.join(locale, notes.link).replace(/\\+/g, '/'))
}
if (notesLinks.some((link) => page.path.startsWith(link))) return
const RE_LOCALE = new RegExp(