Skip to main content
Anchors are how a rendered page tells the editor what it is looking at. They are plain attributes added at build time. No script, no runtime cost, a few bytes per field.

The attributes

Row-level fields on an article or form (title, date) use a reserved meta id so the editor patches the row rather than a body component.

The helpers

The SDK exports one set of helpers. Each returns a plain attribute object that spreads identically onto an Astro element or a React element, so the attribute names can never diverge between stacks. The template re-exports them from lib/stage-anchors.ts.

Rules for renderers

1

Render the raw stored value

The editor baselines from what is rendered. A truncated or reformatted render would drift from the stored value. Dates are the exception: a date anchor baselines from the stored value and opens a calendar.
2

Anchor the element that holds the text

Not a parent. The editor makes exactly that element editable.
3

Sanitise HTML on the way in and out

Rich fields render through sanitizeHtml and are cleaned again on save. Inline markup survives, scripts and unexpected tags do not.
4

Leave anchors in production

They are inert and named so the platform is invisible in view-source. To strip them from a public-only build, the SDK has one emit switch every stack routes through.
Anchors were originally named data-stage-*. The editor still reads both names during the transition.

Next steps

Components

A full renderer, registered.

The write model

What happens to a patch.