Marking fields
For a field to be edited right on the page, the element that shows it carries the editable marker. The marker is typed by the content: a path the content does not have does not compile.
---import { editable } from "@seamlet/astro/schema";import type { Content } from "../schema";
interface Props { content: Content;}
const { content } = Astro.props;const edit = editable<Content>();---
<header {...edit("hero")}> <h1 {...edit("hero", "title")}>{content.hero.title}</h1></header>
<ul> {content.menu.map((dish, index) => ( <li {...edit("menu", index)}> <h3 {...edit("menu", index, "name")}>{dish.name}</h3> <span {...edit("menu", index, "price")}>{dish.price}</span> ₽ </li> ))}</ul>The marker is the attribute data-cms-path="menu.2.price". Visitors do not see it.
What is edited how
Section titled “What is edited how”-
A text is typed right on the page if its element shows it as it is: without formatting and without other marked fields inside. A multi-line text only where the page shows line breaks (
white-space: pre-lineor<br>). -
A formatted text (
richText) is typed on the page too, if the marked element holds only theRichTextcomponent. The buttons for bold, italic, link and list are in the editor’s edit row, and under the text on a phone. The page renders the element anew with the same elements as the component, so style them from around it, not with classes of your own on them. -
The words of a link or a button (
link) are typed on the page, and where it leads is chosen in the panel. -
A number is typed on the page if its element holds only the number:
240, and with package 2.6.0 and newer also with spaces between thousands and a decimal comma,1 990and2,5. Mark the digits and leave the unit and the words around them outside. While the owner types, the page takes only digits, spaces and a comma into the number:<p class="price">от{" "}<span {...edit("menu", index, "price")}>{dish.price?.toLocaleString("ru-RU")}</span>{" "}₽</p> -
A time (
time) is typed on the page if its element shows it as it is,19:00(package 2.6.0 and newer). While the owner types, the page takes only digits and a colon. -
Everything else is edited in the panel beside the page (at the bottom of the screen on a phone): a number together with other words in its element («1 500 ₽», «от 240», “from 240”), a date, a photo, and a text the site shows otherwise — for example, in capitals through
text-transform. If an element shows one field among its own words («обжарено 4 дня назад», “roasted 4 days ago”; «240 ₽»), the panel quotes them: «На странице: «240 ₽». Слова вокруг пишет сайт, здесь меняется только число» (“On the page: “240 ₽”. The site writes the words around it; only the number changes here”). -
A record of a collection (
edit("menu", index)) is selected by a click between its fields: the panel shows the buttons «Страница» (Page), «Выше» (Up), «Ниже» (Down), «После» (After), «Удалить» (Delete) and the fields of the record the page does not show. On a phone the buttons stand over the record when any field inside it is selected. -
A photo is replaced by a double click or by dragging a file from the computer right onto it.
Unmarked fields are edited in the «Поля» (Fields) panel beside the page.
While the owner types, Tab and Shift+Tab move the cursor to the next and the previous field in the page’s order, and Esc ends typing and keeps the text. On a phone a tap gives the keyboard at once to the field it selected — to the words of a link, a number and a time too. The bridge of package 2.6.0 and newer does this; with an older package on the site, the editor types texts, links on a computer and a number of digits alone on the page, and opens the rest in the panel.
What the page hides
Section titled “What the page hides”A field is edited where it is seen. When the owner selects a field in the «Поля» (Fields) panel, the editor opens what hides it.
- A plain
<details>needs nothing: a click on its summary in the editor opens it too. - Tabs, filters and switches made of radio buttons and checkboxes and shown with CSS work by themselves too: a click on them flips them, and the page remembers that after every edit.
- A part the site hides and shows with its own script (its own accordion, a step of a quiz, a dialog) gets the attribute
data-cms-reveal. When a field inside it is selected, the bridge putsdata-cms-revealedon it and sends it the bubbling eventcms:reveal. Show it with CSS or with your script:
[data-cms-reveal][data-cms-revealed] { display: block;}What is open stays open when the page is rendered anew after an edit.
What moves
Section titled “What moves”A text that moves (a marquee, a split-flap board, a spinning stamp) cannot be typed in place, and a moving target is hard to hit. Put the attribute data-cms-popover (POPOVER_ATTRIBUTE of @seamlet/astro/schema, package 2.2.0 and newer) on such a part or on the marked element itself:
- its fields are edited only in the editor’s panel, they are not typed on the page;
- in the editor the part holds still while the pointer is over it and while its field is selected. The bridge pauses its CSS animations and transitions itself and puts
data-cms-heldon it. If the site moves it with its own script, let the script stop the motion while this attribute is there.
---import { POPOVER_ATTRIBUTE } from "@seamlet/astro/schema";---
<div class="marquee" {...{ [POPOVER_ATTRIBUTE]: "" }}> <p {...edit("specials", "line")}>{content.specials.line}</p></div>Outside the editor nothing changes.
Texts the code owns
Section titled “Texts the code owns”A text without a field marker is not edited in the editor: under the pointer it gets a grey dashed outline «Текст сайта — меняет разработчик» (“Site text — changed by the developer”), and a click on it selects nothing and repeats this in the edit row (package 2.6.0 and newer). So every text a visitor reads is either a field with an edit(...) marker or the code’s text: the words of buttons and navigation («Меню», «Назад»), a fixed legal text, what the code builds from the content (an «Открыто» “Open” status, a sum, the year in a copyright line). Mark the code’s texts with the attribute data-cms-fixed (FIXED_TEXT_ATTRIBUTE of @seamlet/astro/schema, package 2.4.0 and newer) — on the element itself or on a part around it:
<nav class="site-nav" data-cms-fixed> <a href="/menu">Меню</a> <a href="/contacts">Контакты</a></nav><p data-cms-fixed>© 2026 Моя кофейня</p>The check also counts a text inside an element with a field marker as marked. There is no need to mark what is hidden (hidden, aria-hidden="true"), <script>, <style>, <template>, <option> items and single signs like · and →.
Checking the markup
Section titled “Checking the markup”After astro build the integration renders every page of the site in the preview with the initial content — the way the editor shows it the first time — and the page of every record too. Then it lists the visible texts without a field marker and without data-cms-fixed. Texts that are on every page (the header, the footer) are listed once:
[@seamlet/astro] 3 texts of the pages have no field, so the CMS's editor cannot edit them. Mark each with editable() of its field, or with data-cms-fixed when the code owns it: every page: «Каталог» in header > nav > a /catalog/[record]: «Похожие товары» in section.related > h2Mark every text of the list: edit(...) if the owner edits it, or data-cms-fixed if the code owns it. What to do with what is found is decided by the integration’s checks option:
import node from "@astrojs/node";import seamlet from "@seamlet/astro";import { defineConfig } from "astro/config";
export default defineConfig({ adapter: node({ mode: "standalone" }), integrations: [seamlet({ checks: "strict" })],});"warn"— the default: the build prints the list and goes on;"strict"— the build stops if there is at least one such text;"off"— no check.
The check renders the pages with the built @astrojs/node server on your computer and asks the CMS nothing. With another adapter it is skipped.
Hints in the editor’s console
Section titled “Hints in the editor’s console”When a page is open in the CMS’s editor, the preview writes the same list for the page shown to the console of its frame — once. And as fields come into view, it names the fields that cannot be selected on the page: at any point of them a click selects another element.
A click in the editor selects the smallest marked element whose box holds the point — among the elements of the block the click landed in. So a photo and a price under a link stretched over the whole card (a::after { position: absolute; inset: 0 }) are selected where they stand, if the link lies inside the marked element of the record. A field under a sticky header is checked by the preview once it comes out from under it.
The hint appears when a field is covered by an element outside its block: a layer over a section, a floating button, a card’s link without a record marker around it. Raise the marked fields above such an element — in a card, a visitor still opens it by a click anywhere else:
.card { position: relative;}.card-name a::after { content: ""; position: absolute; inset: 0;}.card [data-cms-path] { position: relative; z-index: 1;}Links between pages
Section titled “Links between pages”Links are written as on the published site: <a href="/menu">. A click on a link in the editor opens the page it leads to. A link that is itself marked as a field (for example, a phone) opens its editing.
Security
Section titled “Security”A site never renders content as raw HTML (set:html). The editor trusts what the preview reports, and a client’s text that became a script could act in the editor on behalf of whoever opened it.