Skip to main content

SchemaPresetsBlockOrder

Makes sure that the schema presets blocks are correctly used in the block_order attribute.


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

In the following example, the block_order attribute is missing the block_2 block:

{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text"
},
"block_2": {
"type": "text"
}
},
"block_order": ["block_1"]
}
]
{% endschema %}

In the following example, block_2 is static and is included in the block_order attribute, even though it shouldn't be:

{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text"
},
"block_2": {
"type": "text",
"static": true
}
},
"block_order": ["block_1","block_2"]
}
]
{% endschema %}

In the following example, the block_2 is in block_order but is not defined in blocks:

{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text"
}
},
"block_order": ["block_1", "block_2"]
}
]
{% endschema %}

In the following example, the block_order attribute contains the correct blocks:

{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "block_1"
},
"block_2": {
"type": "block_2",
"static": true
}
},
"block_order": [
"block_1"
]
}
]
{% endschema %}

The following example contains the default configuration for this check:

SchemaPresetsBlockOrder:
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?