FunctionsCanopy
canopy.child
The canopy.child function renders a single child block of a Canopy Nested Block by position.
{{ canopy.child(index) }}| Argument | Description | Data Type |
|---|---|---|
index | The position of the child to render (0-based) | Number |
The function is available inside a parent block's template section and renders one of the block's children with its own block template. Use it when a layout treats one child specially — a featured first slide, for example.
canopy.child renders are display-only: they do not create the editable zone in the Canopy editor. Include one
plain canopy.children() call wherever editors should manage children
visually.
Example
{% canopy template %}
<div class="featured">{{ canopy.child(0) }}</div>
<div class="grid grid-cols-3 gap-4">
{{ canopy.children() }}
</div>
{% endcanopy %}Last updated on