From 3c2ee45cc9291dba4fc0d46b7ecd0c85f3aeae09 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 6 Aug 2023 12:51:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=9A=E8=AF=AD=E8=A8=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=94=99=E8=AF=AF=20(#15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/theme/src/node/autoFrontmatter.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/theme/src/node/autoFrontmatter.ts b/packages/theme/src/node/autoFrontmatter.ts index c8a94e01..644dc5f0 100644 --- a/packages/theme/src/node/autoFrontmatter.ts +++ b/packages/theme/src/node/autoFrontmatter.ts @@ -37,7 +37,8 @@ export default function autoFrontmatter( const locales = (app.siteData.locales || {}) as PlumeThemeLocaleOptions const localesNotesDirs = Object.keys(locales) .map((locale) => { - const notes = localeOption.locales?.[locale].notes + // fixed: #15 + const notes = localeOption.locales?.[locale]?.notes if (!notes) return '' const dir = notes.dir return dir ? normalizePath(path.join(locale, dir)).replace(/^\//, '') : '' @@ -62,7 +63,7 @@ export default function autoFrontmatter( return resolveLocalePath(localeOption.locales!, file) } const notesByLocale = (locale: string) => { - const notes = localeOption.locales![locale].notes || localeOption.notes + const notes = localeOption.locales![locale]?.notes || localeOption.notes if (notes === false) return undefined return notes }