feat(comments): conditional display via frontmatter (#1566)

This commit is contained in:
David Fischer authored and GitHub committed 2024-11-09 04:44:32 -05:00
1 parent a6b2967df8
commit 31e0b7c6f8
3 files changed
+20 -1

No files matched your search

+8 -1
View File
@@ -25,7 +25,14 @@ function boolToStringBool(b: boolean): string {
}
export default ((opts: Options) => {
const Comments: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const Comments: QuartzComponent = ({ displayClass, fileData, cfg }: QuartzComponentProps) => {
// check if comments should be displayed according to frontmatter
const commentsFlag: boolean =
fileData.frontmatter?.comments === true || fileData.frontmatter?.comments === "true"
if (!commentsFlag) {
return <></>
}
return (
<div
class={classNames(displayClass, "giscus")}