diff --git a/packages/my-remark/index.ts b/packages/my-remark/index.ts index bde18c2..3383af7 100644 --- a/packages/my-remark/index.ts +++ b/packages/my-remark/index.ts @@ -53,19 +53,22 @@ export const myRemark: RemarkPlugin = () => { } if (fm.published) { - const publishedLabel = { + let dateLabel = { type: "html" as const, - value: `

${fm.updated ?? fm.published}

`, + value: `

${fm.published}

`, }; + // If the document is associated with an event, skip showing the updated date + if (fm.updated && !fm.tags?.includes("events")) { + dateLabel.value = `

${fm.updated}

`; + } + const firstHeadingIndex = root.children.findIndex( (node) => node.type === "heading" && node.depth === 1 ); if (firstHeadingIndex !== -1) { - root.children.splice(firstHeadingIndex + 1, 0, publishedLabel); + root.children.splice(firstHeadingIndex + 1, 0, dateLabel); } } }; diff --git a/scripts/ob.ts b/scripts/ob.ts index 7b18edd..dee39a2 100644 --- a/scripts/ob.ts +++ b/scripts/ob.ts @@ -75,10 +75,6 @@ async function publishNote(path: string) { fm.updated = today; await updateFrontmatter(path, fm); } - if (fm.draft === false) { - delete fm.draft; - await updateFrontmatter(path, fm); - } } fm.title ??= await extractH1(path);