From 2c69b0c97d40f76363d20478cb799ce4b7518e56 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 8 Dec 2023 16:55:40 -0800 Subject: [PATCH] fix: frontmatter coercion (empty string is falsy) --- quartz/plugins/transformers/frontmatter.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quartz/plugins/transformers/frontmatter.ts b/quartz/plugins/transformers/frontmatter.ts index 017d3d1f1..6498a070c 100644 --- a/quartz/plugins/transformers/frontmatter.ts +++ b/quartz/plugins/transformers/frontmatter.ts @@ -37,16 +37,16 @@ export const FrontMatter: QuartzTransformerPlugin | undefined> }) // tag is an alias for tags - if (data.tag) { - data.tags = data.tag + if (data.tag !== null) { + data.tags = data.tag.toString() } // coerce title to string - if (data.title) { + if (data.title !== null) { data.title = data.title.toString() } - if (data.tags && !Array.isArray(data.tags)) { + if (data.tags !== null && !Array.isArray(data.tags)) { data.tags = data.tags .toString() .split(oneLineTagDelim)