From 668809f4c549c7bb360896c0b8c3894da8a898e9 Mon Sep 17 00:00:00 2001 From: Felix Nie Date: Mon, 17 Mar 2025 12:46:32 +0800 Subject: [PATCH] Dealing with empty and undefined title --- quartz/util/theme.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/util/theme.ts b/quartz/util/theme.ts index 30342fef7..1857f5f28 100644 --- a/quartz/util/theme.ts +++ b/quartz/util/theme.ts @@ -84,7 +84,7 @@ function formatFontSpecification(type: "title" | "header" | "body" | "code", spe export function googleFontHref(theme: Theme, text: string): string[] { const { header, body, code } = theme.typography - const title = (theme.typography.title || undefined) ?? header + const title = theme.typography.title || header const titleFont = formatFontSpecification("title", title) const headerFont = formatFontSpecification("header", header) @@ -147,7 +147,7 @@ ${stylesheet.join("\n\n")} --highlight: ${theme.colors.lightMode.highlight}; --textHighlight: ${theme.colors.lightMode.textHighlight}; - --titleFont: "${getFontSpecificationName(theme.typography.title)}", ${DEFAULT_SANS_SERIF}; + --titleFont: "${getFontSpecificationName(theme.typography.title || theme.typography.header)}", ${DEFAULT_SANS_SERIF}; --headerFont: "${getFontSpecificationName(theme.typography.header)}", ${DEFAULT_SANS_SERIF}; --bodyFont: "${getFontSpecificationName(theme.typography.body)}", ${DEFAULT_SANS_SERIF}; --codeFont: "${getFontSpecificationName(theme.typography.code)}", ${DEFAULT_MONO};