From 2a76f26f94d7b78099f87207ce0056cec185414a Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 19 Feb 2023 02:56:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(theme):=20=E8=A1=A5=E5=85=85=20auto=20front?= =?UTF-8?q?matter=20=E7=BC=BA=E5=A4=B1=E5=AD=97=E6=AE=B5?= 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 b51d98d9..55590d09 100644 --- a/packages/theme/src/node/autoFrontmatter.ts +++ b/packages/theme/src/node/autoFrontmatter.ts @@ -60,13 +60,13 @@ export default function ( // note 首页链接 include: path.join(notesDir, `**/{readme,README,index}.md`), formatter: { - ...baseFormatter, title(title: string, _, { filepath }) { if (title) return title const note = findNote(filepath) if (note?.text) return note.text return getCurrentDirname(note, filepath) || '' }, + ...baseFormatter, permalink(permalink: string, _, { filepath }) { if (permalink) return permalink const note = findNote(filepath) @@ -83,6 +83,7 @@ export default function ( const basename = path.basename(filepath, '.md') return basename }, + ...baseFormatter, permalink(permalink: string, _, { filepath }) { if (permalink) return permalink const note = findNote(filepath) @@ -98,12 +99,12 @@ export default function ( { include: '*', formatter: { - ...baseFormatter, title(title: string, _, { filepath }) { if (title) return title const basename = path.basename(filepath, '.md') return basename }, + ...baseFormatter, permalink(permalink: string) { if (permalink) return permalink return path.join(articlePrefix, nanoid(), '/')