Skip to main content

EmptyBlockContent

Ensures that the Liquid tag {% content_for 'blocks' %} isn't used when the associated schema blocks array is empty or undefined.


The following examples contain code snippets that either fail or pass this check.

In the following example, the Liquid tag {% content_for 'blocks' %} is used with an empty schema blocks array:

<div>
{% content_for 'blocks' %}
</div>

{% schema %}
{
"name": "Test",
"blocks": []
}
{% endschema %}

In the following example, the Liquid tag {% content_for 'blocks' %} is used when the schema blocks array is undefined:

<div>
{% content_for 'blocks' %}
</div>

{% schema %}
{
"name": "Test"
}
{% endschema %}

In the following example, the Liquid tag {% content_for 'blocks' %} is used with a non-empty schema blocks array:

<div>
{% content_for 'blocks' %}
</div>

{% schema %}
{
"name": "Test",
"blocks": [
{
"type": "text"
}
]
}
{% endschema %}

The following example contains the default configuration for this check:

EmptyBlockContent:
enabled: true
severity: warning
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended.


Was this page helpful?