Skip to main content

ValidLocalBlocks

Ensures that local blocks are being used correctly. This check enforces rules to maintain consistency and prevent errors in theme structure.


Anchor to Validation on local blocksValidation on local blocks

This section covers validations for local blocks in sections and in theme blocks.

In this example, local blocks are being defined within theme blocks:

blocks/local-block.liquid

{% schema %}
{
"name": "Block name",
"blocks": [
{
"type": "local_block",
"name": "Local Block"
}
]
}
{% endschema %}

In this example, theme blocks are being used along with local blocks:

sections/local-block.liquid

{% schema %}
{
"name": "Section name",
"blocks": [
{
"type": "text"
},
{
"type": "local_block",
"name": "Local Block"
}
]
}
{% endschema %}

In this example, local blocks are being used correctly within sections, and are not being used alongside theme blocks:

sections/local-block.liquid

{% schema %}
{
"name": "Section name",
"blocks": [
{
"type": "local_block",
"name": "Local Block"
}
]
}
{% endschema %}

The following example contains the default configuration for this check:

ValidLocalBlocks:
enabled: true
severity: error
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?