CaptureOnContentForBlock
Identifies the usage of content_for "block"
inside the capture
tag, as it's restricted to enforce static block rendering at its expected location.
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 content_for "block"
tag is used inside of the capture
tag:
{% capture x %}
{% content_for "block", type: "text", id:"static-block-id" %}
{% endcapture %}
Anchor to ✓ Pass✓ Pass
In the following example, the content_for "block"
tag is outside the capture
tag, rendering content as expected:
{% capture x %}
Captured content
{% endcapture %}
{% content_for "block", type: "text", id:"static-block-id" %}
Anchor to OptionsOptions
The following example contains the default configuration for this check:
CaptureOnContentForBlock
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?