Jacky Zhao
2024-01-24 b22bcd17b4301c6ef398124eec11f6dff0c2d37d
1
2
3
4
5
6
7
8
9
10
11
12
13
import { QuartzFilterPlugin } from "../types"
 
export const ExplicitPublish: QuartzFilterPlugin = () => ({
  name: "ExplicitPublish",
  shouldPublish(_ctx, [_tree, vfile]) {
    const publishProperty = vfile.data?.frontmatter?.publish ?? false
    const publishFlag =
      typeof publishProperty === "string"
        ? publishProperty.toLowerCase() === "true"
        : Boolean(publishProperty)
    return publishFlag
  },
})