From 7ac94e1d840b58e1400e5dd08533eed9e7418d70 Mon Sep 17 00:00:00 2001
From: Emile Bangma <github@emilebangma.com>
Date: Sun, 1 Dec 2024 03:03:20 +0100
Subject: [PATCH] fix(comments): properly check if comments is in frontmatter
 (#1627)

---
 quartz/components/Comments.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/quartz/components/Comments.tsx b/quartz/components/Comments.tsx
index 5f29860..0bfd82d 100644
--- a/quartz/components/Comments.tsx
+++ b/quartz/components/Comments.tsx
@@ -28,7 +28,8 @@ export default ((opts: Options) => {
   const Comments: QuartzComponent = ({ displayClass, fileData, cfg }: QuartzComponentProps) => {
     // check if comments should be displayed according to frontmatter
     const disableComment: boolean =
-      !fileData.frontmatter?.comments || fileData.frontmatter?.comments === "false"
+      typeof fileData.frontmatter?.comments !== "undefined" &&
+      (!fileData.frontmatter?.comments || fileData.frontmatter?.comments === "false")
     if (disableComment) {
       return <></>
     }