EmptyBlockContent
Ensures that the Liquid tag {% content_for 'blocks' %}
isn't used when the associated schema blocks
array is empty or undefined.
Anchor to ExamplesExamples
The following examples contain code snippets that either fail or pass this check.
Anchor to ✗ Fail✗ Fail
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 %}
Anchor to ✓ Pass✓ Pass
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 %}
Anchor to OptionsOptions
The following example contains the default configuration for this check:
EmptyBlockContent
enabledtrue
severity warning
Parameter | Description |
---|---|
enabled | Whether this check is enabled. |
severity | The severity of the check. |
Anchor to Disabling this checkDisabling this check
Disabling this check isn't recommended.
Was this page helpful?