--- title: EmptyBlockContent description: >- A validation that identifies instances where the content_for blocks Liquid tag is used when the associated blocks array is empty or undefined. source_url: html: >- https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content md: >- https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md --- ExpandOn this page * [Examples](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md#examples) * [Options](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md#options) * [Disabling this check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md#disabling-this-check) # EmptyBlockContent Ensures that the Liquid tag `{% content_for 'blocks' %}` isn't used when the associated schema `blocks` array is empty or undefined. *** ## Examples The following examples contain code snippets that either fail or pass this check. ### ✗ Fail In the following example, the Liquid tag `{% content_for 'blocks' %}` is used with an empty schema `blocks` array: ```liquid
{% content_for 'blocks' %}
{% schema %} { "name": "Test", "blocks": [] } {% endschema %} ``` In the following example, the Liquid tag `{% content_for 'blocks' %}` is used when the schema `blocks` array is undefined: ```liquid
{% content_for 'blocks' %}
{% schema %} { "name": "Test" } {% endschema %} ``` ### ✓ Pass In the following example, the Liquid tag `{% content_for 'blocks' %}` is used with a non-empty schema `blocks` array: ```liquid
{% content_for 'blocks' %}
{% schema %} { "name": "Test", "blocks": [ { "type": "text" } ] } {% endschema %} ``` *** ## Options The following example contains the default configuration for this check: ```yaml EmptyBlockContent: enabled: true severity: warning ``` | Parameter | Description | | - | - | | `enabled` | Whether this check is enabled. | | `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. | *** ## Disabling this check Disabling this check isn't recommended. *** * [Examples](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md#examples) * [Options](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md#options) * [Disabling this check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/empty-block-content.md#disabling-this-check)