SchemaPresetsStaticBlocks
Warns if a preset static block doesn't have a corresponding content_for
block tag.
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 static preset block with id: "block_2"
is missing a content_for
block:
{% content_for "block", type: "text", id: "block_1" %}
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text",
"static": true
},
"block_2": {
"type": "slide",
"static": true
}
}
}
]
{% endschema %}
Anchor to ✗ Fail✗ Fail
In the following example, the static preset block with id: "block_2"
is missing a content_for
block:
{% content_for "block", type: "text", id: "block_1" %}
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": [
{
"type": "text",
"static": true,
"id": "block_1"
},
{
"type": "slide",
"static": true,
"id": "block_2"
}
]
}
]
{% endschema %}
Anchor to ✓ Pass✓ Pass
In the following example, all static preset blocks have a content_for
block:
{% content_for "block", type: "text", id: "block_1" %}
{% content_for "block", type: "slide", id: "block_2" %}
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text",
"static": true
},
"block_2": {
"type": "slide",
"static": true
}
}
}
]
{% endschema %}
Anchor to ✓ Pass✓ Pass
In the following example, all static preset blocks have a content_for
block:
{% content_for "block", type:"text", id:"block_1" %}
{% content_for "block", type:"slide", id:"block_2" %}
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": [ {
"type": "text",
"static": true,
"id": "block_1"
},
"block_2": {
"type": "slide",
"static": true,
"id": "block_2"
}
]
}
]
{% endschema %}
Anchor to OptionsOptions
The following example contains the default configuration for this check:
SchemaPresetsStaticBlocks
enabledtrue
severity error
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?