mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 23:04: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
|
```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
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|||||||
@ -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 <></>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user