@rmdes/indiekit-endpoint-micropub
v1.0.0-beta.27
Published
Micropub endpoint for Indiekit with custom type-based post discovery. Enables publishing content to your website using the Micropub protocol.
Maintainers
Readme
@rmdes/indiekit-endpoint-micropub
Micropub endpoint for Indiekit. Enables publishing content to your website using the Micropub protocol.
Fork Notice
This is a fork of @indiekit/endpoint-micropub with a fix for syndication services that require pre-syndication markup.
Issue Fixed
Services like IndieNews require a u-syndication link in your HTML before they receive the syndication webmention. The upstream Micropub endpoint strips all mp-* properties (including mp-syndicate-to) before passing data to the preset's postTemplate().
This fork preserves mp-syndicate-to so that:
- The property reaches the preset's
postTemplate() - The preset can include it in frontmatter (as
mpSyndicateToin Eleventy) - The theme can render the
u-syndicationlink - IndieNews (and similar services) can find the link when parsing the webmention
Technical Details
The change is in lib/utils.js:
// mp- properties to preserve for the template (needed for pre-syndication markup)
const preserveMpProperties = ["mp-syndicate-to"];
for (let key in templateProperties) {
if (key.startsWith("mp-") && !preserveMpProperties.includes(key)) {
delete templateProperties[key];
}
// ...
}Installation
npm install @rmdes/indiekit-endpoint-micropubUsing npm overrides (recommended)
Add to your package.json:
{
"overrides": {
"@indiekit/endpoint-micropub": "npm:@rmdes/indiekit-endpoint-micropub@^1.0.0-beta.25"
}
}This replaces the upstream package with this fork without changing your plugin configuration.
Options
| Option | Type | Description |
| :---------- | :------- | :------------------------------------------------------------------------ |
| mountPath | string | Path to listen to Micropub requests. Optional, defaults to /micropub. |
Supported endpoint queries
- Configuration:
/micropub?q=config - Media endpoint location:
/micropub?q=media-endpoint - Available syndication targets (list):
/micropub?q=syndicate-to - Supported queries:
/micropub?q=config - Supported vocabularies (list):
/micropub?q=post-types - Publication categories (list):
/micropub?q=category - Previously published posts (list):
/micropub?q=source - Source content:
/micropub?q=source&url=WEBSITE_URL
List queries support filter, limit and offset and parameters. For example, /micropub?q=source&filter=web&limit=10&offset=10.
License
MIT - Original work by Paul Robert Lloyd, syndication fix by Ricardo Mendes.
