İçeriğe geç
HOC Site Docs
Esc
↑↓gezin↵aç⌘Jönizle
Bu sayfada

Array template

Array template

Aşağıdaki alan düzeyi katalog tabloları İngilizce kalır — düzenleyici, API ve MCP’nin kullandığı makine tasarım şemasıyla birebir uyumludur.

List/repeater primitive: repeats its content slot once per item of an array or entry[] variable (or array-like binding). Set arrayBinding to a whole-value token such as {{var:hits}}, {{var:items}}, or {{bind:…}}. Inside the slot the current row is aliased as item — use {{var:item.<fieldKey>}} (and nested paths). For entry[] results, object field keys are flattened from fieldValues onto item so tokens omit .fieldValues. Optional columnsByBreakpoint (+ gaps) lays rows out as a CSS grid (each row is a grid item). Prefer columns on VAT rather than wrapping VAT in a single GridListBlock/GridBlock cell. For outer gaps/columns around the template, prefer FlexListBlock / GridListBlock. Row DOM ids are suffixed with -{index}. Child blocks can use shell hideWhenEmpty: "{{var:item.link}}" to skip empty fields. Prefer create_component_preset kind=list. This is the ObjectDisplay list replacement — do not invent a list mega-block or copy ObjectBoundField onto pages.

Examples

Search hits list

{
  "arrayBinding": "{{var:hits}}",
  "content": [
    {
      "type": "HeadingBlock",
      "props": {
        "text": "{{var:item.title}}",
        "fontSize": 24
      }
    }
  ]
}

Component input items

{
  "arrayBinding": "{{var:items}}",
  "content": [
    {
      "type": "HeadingBlock",
      "props": {
        "text": "{{var:item.name}}"
      }
    }
  ]
}

Fields

content

Template slot rendered once per array item. Tokens resolve in a scope where the current row is item ({{var:item.<fieldKey>}}). Empty arrays render nothing on the published site; the editor shows a single sample row.

content: [{ type: "HeadingBlock", props: { text: "{{var:item.title}}" } }]

arrayBinding

Whole-value {{var:id}} or {{bind:id}} selecting an array or entry[] source. Nested object arrays use {{var:parent.field}}. Partial/string interpolation is ignored — binding must be the entire token.

arrayBinding: "{{var:hits}}"
Default props
{
  "arrayBinding": "",
  "content": [],
  "layout": {}
}

Bu sayfa yardımcı oldu mu?