mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 14:34:23 +02:00
Feat(filters): Support "true" as valid for draft and publish frontmatter values (b3a02909ba74fff08cd3675707d1f4d782a24e98)
This commit is contained in:
parent
9f701e5045
commit
ad52d09567
@ -3,7 +3,8 @@ import { QuartzFilterPlugin } from "../types"
|
|||||||
export const RemoveDrafts: QuartzFilterPlugin<{}> = () => ({
|
export const RemoveDrafts: QuartzFilterPlugin<{}> = () => ({
|
||||||
name: "RemoveDrafts",
|
name: "RemoveDrafts",
|
||||||
shouldPublish(_ctx, [_tree, vfile]) {
|
shouldPublish(_ctx, [_tree, vfile]) {
|
||||||
const draftFlag: boolean = vfile.data?.frontmatter?.draft === true
|
const draftFlag: boolean =
|
||||||
|
vfile.data?.frontmatter?.draft === true || vfile.data?.frontmatter?.draft === "true"
|
||||||
return !draftFlag
|
return !draftFlag
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -3,6 +3,6 @@ import { QuartzFilterPlugin } from "../types"
|
|||||||
export const ExplicitPublish: QuartzFilterPlugin = () => ({
|
export const ExplicitPublish: QuartzFilterPlugin = () => ({
|
||||||
name: "ExplicitPublish",
|
name: "ExplicitPublish",
|
||||||
shouldPublish(_ctx, [_tree, vfile]) {
|
shouldPublish(_ctx, [_tree, vfile]) {
|
||||||
return vfile.data?.frontmatter?.publish === true
|
return vfile.data?.frontmatter?.publish === true || vfile.data?.frontmatter?.publish === "true"
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -88,8 +88,8 @@ declare module "vfile" {
|
|||||||
tags: string[]
|
tags: string[]
|
||||||
aliases: string[]
|
aliases: string[]
|
||||||
description: string
|
description: string
|
||||||
publish: boolean
|
publish: boolean | string
|
||||||
draft: boolean
|
draft: boolean | string
|
||||||
lang: string
|
lang: string
|
||||||
enableToc: string
|
enableToc: string
|
||||||
cssclasses: string[]
|
cssclasses: string[]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user