Add plugin API for publish policy helpers

Use case or problem

A number of the existing publish-related feature requests amount to “I need more automated support for my publish workflow, specifically for X”. The current Obsidian Publish feature’s workflow support is limited to the frontmatter publish: <boolean> key. Instead, support an approach for first-class automated filtering that can be configured by the user to support the specific needs and workflow of the published vault.

Proposed solution

Other requests suggest adding some kind of query support ala dataview to Obsidian Publish. That puts Obsidian devs in the way of creating and supporting the policy mechanism. Instead, I suggest that a plugin API be added that allows plugins to inform the Publish UI policy for each changed asset in the vault.

Examples

  • Treat everything in Pending/ or Backstage/, or with tag #hidden as publish: false
  • Treat everything changed with tag #ready-to-go as publish: true, removing that tag before publication
  • Treat everything changed without tag #ready-to-go as ‘publish: false`, and pop these up via plugin UI to let the user know about the unpublished changes.

Implementation approach

Offhand, the most likely implementation would be publish workflow hooks, such as:

  • “just before publishing” – receives a list of changed assets, and returns a data structure annotated per the API contract. (e.g. a publish true/false filter). May optionally display UI or perform other side effects.
  • "just after publishing” – receives a list of the published assets. May optionally display UI or perform other side effects.

Related Feature Requests

1 Like