From 5942876c924047fede506d6120c9d301fc823c05 Mon Sep 17 00:00:00 2001 From: Jiaxin Peng Date: Tue, 22 Oct 2024 10:27:33 +0100 Subject: [PATCH] fix: cannot parse title from front matter --- src/upload/upoload_custom/getMarkdownCustom.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/upload/upoload_custom/getMarkdownCustom.ts b/src/upload/upoload_custom/getMarkdownCustom.ts index 75bd41b..c4bd7c4 100644 --- a/src/upload/upoload_custom/getMarkdownCustom.ts +++ b/src/upload/upoload_custom/getMarkdownCustom.ts @@ -35,7 +35,10 @@ export async function getNowFileMarkdownContentCustom( // If a 'title' type property exists, use the file's basename as its value if (titleProperty) { - customValues[titleProperty.customName] = nowFile.basename; // Use 'basename' for the file name without extension + customValues[titleProperty.customName] = + (FileCache.frontmatter && FileCache.frontmatter[titleProperty.customName]) ? + FileCache.frontmatter[titleProperty.customName] : // use the front matter value if it exists + nowFile.basename; // Use 'basename' for the file name without extension } } catch (error) {