From 7769bc888fd9a32f83e4591ad8e467e6b66b2070 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 12 Jul 2024 02:32:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(theme):=20=E4=BF=AE=E5=A4=8D=20auto=20front?= =?UTF-8?q?matter=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- theme/src/client/styles/content.css | 4 -- .../node/autoFrontmatter/resolveOptions.ts | 57 +++++++++---------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/theme/src/client/styles/content.css b/theme/src/client/styles/content.css index a0588952..8efbcc50 100644 --- a/theme/src/client/styles/content.css +++ b/theme/src/client/styles/content.css @@ -98,10 +98,6 @@ } } -.vp-doc > h1:first-of-type { - display: none; -} - .vp-doc img { display: inline-block; } diff --git a/theme/src/node/autoFrontmatter/resolveOptions.ts b/theme/src/node/autoFrontmatter/resolveOptions.ts index ffd2d9f9..d4eb8e9d 100644 --- a/theme/src/node/autoFrontmatter/resolveOptions.ts +++ b/theme/src/node/autoFrontmatter/resolveOptions.ts @@ -194,36 +194,35 @@ export function resolveOptions( include: '**/{readme,README,index}.md', frontmatter: {}, }, - toArray(localeOptions.blog?.include).length - ? { - include: localeOptions.blog?.include, - frontmatter: { - ...options.title !== false - ? { - title(title: string, { relativePath }) { - if (title) - return title - const basename = path.basename(relativePath || '', '.md') - return basename - }, - } as AutoFrontmatterObject - : undefined, - ...baseFrontmatter, - ...options.permalink !== false - ? { - permalink(permalink: string, { relativePath }) { - if (permalink) - return permalink - const locale = resolveLocale(relativePath) - const prefix = withBase(articlePrefix, locale) + { + include: localeOptions.blog?.include ?? ['**/*.md'], + frontmatter: { + ...options.title !== false + ? { + title(title: string, { relativePath }) { + if (title) + return title + const basename = path.basename(relativePath || '', '.md') + return basename + }, + } as AutoFrontmatterObject + : undefined, + ...baseFrontmatter, + ...options.permalink !== false + ? { + permalink(permalink: string, { relativePath }) { + if (permalink) + return permalink + const locale = resolveLocale(relativePath) + const prefix = withBase(articlePrefix, locale) + + return normalizePath(`${prefix}/${nanoid()}/`) + }, + } as AutoFrontmatterObject + : undefined, + }, + }, - return normalizePath(`${prefix}/${nanoid()}/`) - }, - } as AutoFrontmatterObject - : undefined, - }, - } - : '', { include: '*', frontmatter: {