Blogging & Open Web

Micropub for a Personal Website - Keep the Editor Replaceable, Keep the Published URL

Micropub for a Personal Website - Keep the Editor Replaceable, Keep the Published URL

Micropub for a Personal Website - Keep the Editor Replaceable, Keep the Published URL

A personal website may own its pages yet still tie every writing session to one administration screen. That arrangement works until the editor is awkward on a phone, a new writing tool appears, or the site owner wants an automation to create a draft without teaching it the CMS's private database structure. Is there a useful boundary between the tool that composes a post and the website that finally publishes it?

Micropub defines such a boundary. It is an HTTP protocol through which a client can create, update, and delete content on a server. The client might be a web editor, a native application, or a small automation; the resulting post still belongs to the destination website and receives a URL there. This does not make every editor interchangeable without effort, and it does not turn an endpoint into a safe CMS by itself. It standardizes a conversation while leaving many consequential decisions to the site.

Three Parts That Are Easy to Confuse

Micropub answers a content-management question: how does an authorized client ask a site to create or change a post? It does not define the login ceremony in full. In the IndieWeb ecosystem, IndieAuth commonly handles discovery and delegated authorization, producing an access token that the client can present to the Micropub endpoint.

ActivityPub solves another problem. It describes activities exchanged by clients and federated servers, including delivery to remote inboxes. Micropub can be used to write a post that a site later federates, but it does not itself deliver that post to followers. Similarly, Webmention can notify another page that it was linked; it is not a remote editing API. These protocols can meet in one publishing system without becoming the same layer.

A useful mental model is a small publishing desk. IndieAuth decides which editor receives a key and what that key permits. Micropub defines the forms that the editor can hand to the desk. The CMS still decides how to store, review, render, and distribute the accepted material.

Discovery Before a Write

A profile or homepage can advertise its Micropub endpoint with an HTML link:

<link rel="micropub" href="https://example.com/micropub">

An HTTP Link header can advertise the same relation. This discovery step matters because a client can begin with the user's URL instead of requiring a server-specific endpoint to be typed into a settings page. The publishing endpoint may move later while the profile URL remains the starting point.

Discovery is not authorization. Finding a door does not grant permission to open it. The client still needs an access token with suitable privileges, and the endpoint must validate that token for every protected request. A public rel=micropub link is therefore metadata, not a secret.

A Create Request Is a Vocabulary, Not a Database Insert

The simplest Micropub create request can be form encoded, but JSON makes the structure of an article easier to see. The following shape is adapted from the specification; the token is deliberately represented only by a placeholder:

POST /micropub HTTP/1.1
Host: example.com
Authorization: Bearer REDACTED
Content-Type: application/json

{
  "type": ["h-entry"],
  "properties": {
    "name": ["A Small Publishing Boundary"],
    "content": [
      {"html": "<p>The article body belongs here.</p>"}
    ],
    "category": ["open-web", "publishing"]
  }
}

The arrays are significant in the JSON representation, even when a property has one value. A conforming Micropub server must support creating h-entry objects and must support the form-encoded creation syntax. JSON creation is useful for structured values, but it is not the minimum required create format. That distinction prevents a convenient example from being mistaken for the entire conformance floor.

h-entry supplies content terms such as name, content, published, and category. Those names do not prescribe SQL columns. One CMS may map name to a title field and categories to numeric relationships; another may write files with front matter. The endpoint is an adapter between a shared vocabulary and a local content model.

After accepting a create request, the server returns 201 Created or 202 Accepted and a Location header containing the new post URL. The difference matters. A 201 response says the resource was created; 202 allows asynchronous processing after synchronous validation. Neither status tells the client whether an editorial team considers the post polished, whether it appears in navigation, or whether a feed has refreshed. Those are local workflow questions.

Editing Requires a Readable Source Model

Creating content is only the first half of editor portability. Before changing an existing article, a client needs the source properties rather than a scraped copy of the rendered page. Micropub defines a q=source query for that purpose. A server that supports updates must support this source query and return Microformats2 JSON.

An update can then replace all values of a property, add values, or delete a property or selected values. That is more precise than sending a complete replacement document for every small change. It also exposes a difficult mapping problem: the endpoint must know which public URL belongs to which internal record and must ensure the token holder is allowed to modify that record.

The protocol says that unrecognized properties are ignored during creation while recognized properties are used. This supports clients that can describe richer posts than a particular server understands. The tradeoff is quiet loss: a request may succeed while a property the author expected to preserve is absent. A responsible client should show server capabilities and results clearly; a responsible server should log enough context to diagnose omissions without recording access tokens.

Update and delete support are recommendations in the specification, not requirements for every conforming server. A create-only endpoint can therefore be a legitimate first boundary, provided clients and users are not led to expect editing that the server does not offer.

Media Is a Separate Boundary for a Reason

Micropub permits an optional media endpoint. A client uploads a file there using multipart/form-data; a successful endpoint returns 201 Created and the media URL in Location. The client can then refer to that URL in a later post request. A configuration query, q=config, lets the client discover this endpoint.

Separating upload from post creation improves some workflows, especially when a large file can be transferred while the author continues writing. It also makes the security boundary visible. The media endpoint still has to enforce file-size limits, inspect actual media types, choose safe names, control storage paths, and decide whether unused uploads expire. Micropub describes the exchange; it does not certify a file as harmless.

Remote media URLs deserve similar caution. The specification permits URL values and allows a server to fetch a copy. If an implementation chooses to fetch user-supplied URLs, that becomes a server-side request forgery surface. Address validation, redirect handling, response limits, timeouts, and private-network protections belong in the implementation's threat model, not in an assumption that a standard property is automatically safe.

The Token Is Permission, Not Decoration

Micropub uses OAuth bearer tokens. As RFC 6750 explains, whoever possesses a bearer token can use the authority it carries without proving possession of a separate cryptographic key. Tokens therefore need protection in transit, in storage, in logs, and in error reports. The Authorization: Bearer header is the sensible place to send one; placing a token in a page URL risks exposing it through histories and logs.

The authorization side has evolved since the W3C Micropub Recommendation was published in 2017. The current IndieAuth living standard uses authorization-server metadata and requires PKCE for IndieAuth clients. The broader OAuth 2.0 Security Best Current Practice calls for exact redirect URI matching, protection of authorization-code flows, TLS, and privileges restricted to what the client needs.

For a publishing endpoint, that means a token approved only for creating posts should not silently gain deletion rights. The server must check both validity and sufficient scope for the requested action. Short lifetimes, revocation, audience restriction, and secure storage can reduce damage, but they do not replace a clear consent screen and narrow permissions. An attractive editor is still third-party code being invited to write to the site.

What Micropub Deliberately Leaves to the CMS

A protocol cannot make every publishing policy universal. Micropub does not decide whether a new entry is a draft or immediately public unless the server and client share an extension or local convention. It does not choose a slug, category ID, author record, canonicalization rule, translation relationship, moderation state, revision policy, or database transaction.

It also does not sanitize HTML on behalf of the CMS. If a client submits HTML content, the endpoint must apply the same content policy as any other trusted-but-fallible editor. Authorization answers who may request a write; validation answers whether the data is acceptable; output handling answers how it can be rendered safely. Collapsing those questions into “the token was valid” gives one credential too much meaning.

This limitation is also the protocol's useful restraint. A file-based static site, a native PHP CMS, and a hosted publishing service can expose the same broad conversation without adopting one database schema. The stable part is the HTTP request and content vocabulary; local architecture remains local.

A Cautious Adoption Path

  1. Write down the desired use case first. Publishing short notes from a phone is narrower than allowing arbitrary edits and media uploads.
  2. Map supported h-entry properties to the existing CMS model. Decide explicitly what happens to unknown properties, drafts, categories, authorship, and HTML.
  3. Implement discovery and one create path with a narrowly scoped token. Keep the ordinary administration interface as a recovery route.
  4. Add source queries and updates only after URL ownership and authorization checks are unambiguous.
  5. Treat media as its own security project rather than a checkbox attached to article creation.
  6. Test failure as carefully as success: missing tokens, insufficient scope, malformed JSON, unsupported properties, duplicate submissions, revoked access, and storage errors.
  7. Use the Micropub Rocks test service to examine protocol behavior, while remembering that a conformance report cannot prove the surrounding CMS, authorization deployment, or editorial workflow is secure.

There is also a reasonable case for not adding Micropub. If one built-in editor works well, no external client is needed, and maintaining OAuth-facing endpoints would exceed the benefit, a private CMS API or no API may be the simpler design. Open standards reduce bespoke coupling; they do not erase operational cost.

The Durable Part Is the Destination

Micropub separates the act of composing from the place where a post ultimately lives. A compatible editor can be replaced, while the website remains responsible for the public URL, storage, rendering, and policy. That is a modest form of portability: not moving the published work between platforms every time the writing tool changes.

The boundary is valuable only when described honestly. Micropub standardizes requests, responses, and a content vocabulary. IndieAuth and OAuth guidance help authorize those requests. The CMS still has to validate data, constrain privileges, protect uploads, preserve revisions, and decide what “published” means. For a personal website, the useful question is not merely whether a Micropub endpoint can be added, but whether that boundary makes publishing more flexible without making responsibility harder to see.

References