refactor plugins to be functions instead of classes
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
import { QuartzFilterPlugin } from "../types"
|
||||
import { ProcessedContent } from "../vfile"
|
||||
|
||||
export class RemoveDrafts extends QuartzFilterPlugin {
|
||||
name = "RemoveDrafts"
|
||||
shouldPublish([_tree, vfile]: ProcessedContent): boolean {
|
||||
export const RemoveDrafts: QuartzFilterPlugin<{}> = () => ({
|
||||
name: "RemoveDrafts",
|
||||
shouldPublish([_tree, vfile]) {
|
||||
const draftFlag: boolean = vfile.data?.frontmatter?.draft ?? false
|
||||
return !draftFlag
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { QuartzFilterPlugin } from "../types"
|
||||
import { ProcessedContent } from "../vfile"
|
||||
|
||||
export class ExplicitPublish extends QuartzFilterPlugin {
|
||||
name = "ExplicitPublish"
|
||||
shouldPublish([_tree, vfile]: ProcessedContent): boolean {
|
||||
export const ExplicitPublish: QuartzFilterPlugin = () => ({
|
||||
name: "ExplicitPublish",
|
||||
shouldPublish([_tree, vfile]) {
|
||||
const publishFlag: boolean = vfile.data?.frontmatter?.publish ?? false
|
||||
return publishFlag
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user