HOC SiteDokümantasyon

Değişkenler

Blokların okuduğu, karşılaştırdığı ve güncellediği yüzey ve site değişkenleri; sayaçlar dahil.

Pages, page components, headers, and footers store surface variables on root.props.variables. Site variables belong to the website and are edited in the same Variables panel. Email documents have no root props.

Ticker variable

Add a document variable with type: "ticker". The stored value is a number. Tickers are available on pages and page components; headers and footers store variables but no tickers.
Settings live on ticker: mode (manual or automatic), min, max, and start. Automatic tickers also set intervalMs (at least 100) and step (default 1).
Passing max wraps to min, and passing min wraps to max. Set, add, and subtract clamp into min/max. Clear returns to start.
A manual ticker changes only when a button updates it. An automatic ticker advances on its interval on the public page and in interactive preview, and stays still while the canvas is in edit mode.
Use a manual ticker as a step index: next and back buttons add or subtract 1, and each step is a normal block whose visibility compares the ticker. Use an automatic ticker as a cycling index: bind a heading or rich text to it, or show one block per value.

Variable visibility

shell.visibility is an Authored boolean list. A { compare } condition hides or shows the block when the variable matches. Inside a VariableArrayTemplateBlock the compare target may be an item field.
Example: { "if": [{ "var": { "id": "<id>", "eq": "2" } }], "is": true } with { "if": "*", "is": false }. Ops on the var object: eq, neq, gt, lt, gte, lte, in, not-in, empty. Hide when empty: { "if": [{ "var": { "id": "<id>", "empty": true } }], "is": false }. Visibility checks are skipped while editing, so every step stays visible on the canvas.

Plural and select text

Localized strings (TextBlock / HeadingBlock / RichText / Button labels / aria labels) may include {{plural:path|=0{…} one{…} other{…}}} or {{select:path|pending{…} other{…}}}. Categories follow CLDR via Intl.PluralRules for the active content locale; # is the formatted number. Unknown categories fall back to other. Malformed expressions are omitted on the public page and flagged by get_design_warnings (design.warning.malformed_message_form). Author each locale's own branches in its overlay.

Site and surface variables

A variable scope of site is shared by the website. Omitted scope is the open document (the surface). The same name may exist in both. {{var:name}} reads the surface value when that surface defines the name, and the site value otherwise. {{var:site.name}} always reads the site value. Names are unique inside one scope.
A site variable with persistCookie is stored in the httpOnly cookie hoc_site_<name> (SameSite=lax). ttlSeconds is the cookie max age; omit it for 400 days. The server fills the value from the cookie when a saved request runs. A value posted by the page cannot replace it.
syncUrl writes the variable to the query string under its name and reads that parameter back, including on the server render. Page 1 is omitted. An older syncQueryKey still means sync is on, but the parameter is the name.
A generator fills the value once when the value and the default are both empty. Unique ID is stored as uuidv7. Other kinds are text (length, and alphabet letters, digits, or both), number (min, max, and decimal), and list (one option id, in the options array order). A fixed value is the variable default, not a generator. Surface generators run once in the browser. Cookie-backed site generators run on the server.
An omitted array itemType is treated as { "type": "text" } and reported as design.warning.array_missing_item_type. A string itemType is ignored and the array is not seeded. defaultValue or a global routeDefaults row (routePageId: null) may be an array such as ["A", "B"]. On a button, set replaces that array (a real array, or a JSON string of one). add appends one item: a string for text items, or an object for object items. Unknown keys on a variable definition are ignored and reported as a warning.

MCP

get_site_variables reads the website's site variables. save_site_variables replaces that array (variables, plus dryRun). Each item is a variable definition with scope: "site", including generator, persistCookie, and ttlSeconds. save_website_settings does not write them. The column is migration 177_website_site_variables; run that migration before these tools can read or write.