From ab7d368485e0a3381bc50eb232ad262adb45d58b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 10 Sep 2024 16:47:18 +0800 Subject: [PATCH] perf(theme): default page title --- theme/src/node/config/resolveLocaleOptions.ts | 1 + theme/src/node/plugins/markdown-title.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/theme/src/node/config/resolveLocaleOptions.ts b/theme/src/node/config/resolveLocaleOptions.ts index 0ea4c033..bb218152 100644 --- a/theme/src/node/config/resolveLocaleOptions.ts +++ b/theme/src/node/config/resolveLocaleOptions.ts @@ -23,6 +23,7 @@ const FALLBACK_OPTIONS: PlumeThemeLocaleData = { navbarSocialInclude: ['github', 'twitter', 'discord', 'facebook'], aside: true, outline: [2, 3], + externalLinkIcon: true, // page meta editLink: true, diff --git a/theme/src/node/plugins/markdown-title.ts b/theme/src/node/plugins/markdown-title.ts index 8c2a8ce0..af20b620 100644 --- a/theme/src/node/plugins/markdown-title.ts +++ b/theme/src/node/plugins/markdown-title.ts @@ -21,8 +21,10 @@ export function markdownTitlePlugin(): Plugin { }) source = `${matter}\n${content}` const result = render(source, env) - if (title) - env.title = title + if (title) { + env.frontmatter ??= {} + env.frontmatter.title ??= title + } return result } },