feat(comments): remove respectFrontmatter flag & update docs

This commit is contained in:
David Fischer 2024-11-05 19:52:40 +01:00
parent 73b83a8768
commit e363223260
No known key found for this signature in database
GPG Key ID: F21F2016DEFEC73D
2 changed files with 4 additions and 6 deletions

View File

@ -57,7 +57,6 @@ Quartz also exposes a few of the other Giscus options as well and you can provid
```ts ```ts
type Options = { type Options = {
provider: "giscus" provider: "giscus"
respectFrontmatter?: boolean
options: { options: {
repo: `${string}/${string}` repo: `${string}/${string}`
repoId: string repoId: string
@ -118,11 +117,11 @@ afterBody: [
#### Conditionally display comments #### Conditionally display comments
Quartz can conditionally display the comment box based on a field `comments` in the frontmatter. To enable this feature, set `respectFrontmatter` to `true` & adjust pages where comments should be enabled: Quartz can conditionally display the comment box based on a field `comments` in the frontmatter. By default, all pages will display comments, to disable it for a specific page, set `comments` to `false`.
``` ```
--- ---
title: Comments enabled here! title: Comments disabled here!
comments: true comments: false
--- ---
``` ```

View File

@ -5,7 +5,6 @@ import script from "./scripts/comments.inline"
type Options = { type Options = {
provider: "giscus" provider: "giscus"
respectFrontmatter?: boolean
options: { options: {
repo: `${string}/${string}` repo: `${string}/${string}`
repoId: string repoId: string
@ -30,7 +29,7 @@ export default ((opts: Options) => {
// check if comments should be displayed according to frontmatter // check if comments should be displayed according to frontmatter
const commentsFlag: boolean = const commentsFlag: boolean =
fileData.frontmatter?.comments === true || fileData.frontmatter?.comments === "true" fileData.frontmatter?.comments === true || fileData.frontmatter?.comments === "true"
if ((opts.respectFrontmatter ?? false) && !commentsFlag) { if (!commentsFlag) {
return <></> return <></>
} }