Skip to content

feat: add getSyndicationUrl hook to syndicator interface - #882

Draft
aciccarello wants to merge 4 commits into
getindiekit:mainfrom
aciccarello:feat/syndication-preprocess-hook-endpoints
Draft

feat: add getSyndicationUrl hook to syndicator interface#882
aciccarello wants to merge 4 commits into
getindiekit:mainfrom
aciccarello:feat/syndication-preprocess-hook-endpoints

Conversation

@aciccarello

Copy link
Copy Markdown
Contributor

Closes #860

Summary

Adds an optional getSyndicationUrl(publication) hook to the syndicator plugin interface, enabling syndication URLs to be written into post files at creation time — without requiring a database or async syndication step.

This is needed for webmention-based syndication targets where the syndication URL is known at post creation time, but mp-syndicate-to is stripped before the file is written (correct per the Micropub spec — it is a server command, not a content property).

Changes

endpoint-syndicate

  • syndicate() is now optional on syndicator targets. Targets without it are skipped rather than throwing. This allows syndicators that only implement getSyndicationUrl() to register without providing an empty no-op.

endpoint-micropub

  • In post-content.js create(), after resolving syndication targets and before getPostTemplateProperties() strips mp-* keys, calls getSyndicationUrl(publication) on any target whose info.uid is in mp-syndicate-to.
  • Returned URLs are normalized to an array, deduplicated against existing syndication values (exact string match), and appended to properties.syndication.
  • Errors from getSyndicationUrl() are caught and logged via debug() — the create request is never failed.

Interface

// Optional method to add to a syndicator target
async getSyndicationUrl(publication) {
  // return string | string[] | null | undefined
}

A syndicator implementing this hook can return the syndication URL synchronously at post creation time. The endpoint handles appending it to syndication before the file is written.

This is scoped to create() only. Update behaviour is a separate concern.

@aciccarello
aciccarello marked this pull request as ready for review August 17, 2026 03:48
@aciccarello
aciccarello marked this pull request as draft August 17, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make syndication available to file at creation for webmention based syndication

1 participant