Skip to main content

content_for

Creates a designated area in your theme where blocks can be rendered.

The content_for tag requires a type parameter to differentiate between rendering a number of theme blocks ('blocks') and a single static block ('block').

Syntax

{% content_for 'blocks' %}
{% content_for 'block', type: "slide", id: "slide-1" %}

Syntax

{% content_for "blocks" %}

Creates a designated area that renders theme blocks as configured in the JSON template or section groups, allowing merchants to add, remove, and rearrange blocks using the theme editor. See theme blocks for more information.

Syntax

{% content_for "block", type: "button", id: "static-block-1", color: "red" %}

Renders a static theme block of the specified type with the provided ID. You can pass additional arbitrary parameters (such as color) that will be accessible within the static block using {{ color }}. See static blocks to learn more.

Was this page helpful?