fix(comments): properly check if comments is in frontmatter (#1627)

This commit is contained in:
Emile Bangma 2024-12-01 03:03:20 +01:00 committed by GitHub
parent e1d754ef79
commit 7ac94e1d84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 <></>
}