mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 14:54:05 -06:00
feat(comments): remove respectFrontmatter flag & update docs
This commit is contained in:
parent
73b83a8768
commit
e363223260
@ -57,7 +57,6 @@ Quartz also exposes a few of the other Giscus options as well and you can provid
|
||||
```ts
|
||||
type Options = {
|
||||
provider: "giscus"
|
||||
respectFrontmatter?: boolean
|
||||
options: {
|
||||
repo: `${string}/${string}`
|
||||
repoId: string
|
||||
@ -118,11 +117,11 @@ afterBody: [
|
||||
|
||||
#### 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!
|
||||
comments: true
|
||||
title: Comments disabled here!
|
||||
comments: false
|
||||
---
|
||||
```
|
||||
|
||||
@ -5,7 +5,6 @@ import script from "./scripts/comments.inline"
|
||||
|
||||
type Options = {
|
||||
provider: "giscus"
|
||||
respectFrontmatter?: boolean
|
||||
options: {
|
||||
repo: `${string}/${string}`
|
||||
repoId: string
|
||||
@ -30,7 +29,7 @@ export default ((opts: Options) => {
|
||||
// check if comments should be displayed according to frontmatter
|
||||
const commentsFlag: boolean =
|
||||
fileData.frontmatter?.comments === true || fileData.frontmatter?.comments === "true"
|
||||
if ((opts.respectFrontmatter ?? false) && !commentsFlag) {
|
||||
if (!commentsFlag) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user