Console
FunctionsCanopy

canopy.children

The canopy.children function renders the child blocks of a Canopy Nested Block inside its parent template.

{{ canopy.children({ only: ..., except: ... }) }}
ArgumentDescriptionData Type
only (optional)Render only children using these templatesString or Array
except (optional)Render all children except those using these templatesString or Array

The function is available inside a parent block's template section and outputs the block's children, in the order editors arranged them. Each child is rendered with its own block template. Short template names match namespaced children, so only: 'wide' matches gallery/wide.

{{ canopy.children() }}                    {# all children, in order #}
{{ canopy.children({ only: 'wide' }) }}      {# subset by template #}
{{ canopy.children({ except: ['wide'] }) }}  {# everything but these #}

Only the plain canopy.children() call creates the editable zone in the Canopy editor. Filtered renders with only or except are display-only — include one plain call wherever editors should manage children visually.

Example

{% canopy template %}
<div class="grid grid-cols-3 gap-4">
  {{ canopy.children() }}
</div>
{% endcanopy %}

Last updated on

On this page