Skip to main content

LiquidTag

Deprecated

This check only exists in Theme Check v1.X.X.

Recommends using {% liquid ... %} if four or more consecutive Liquid tags ({% ... %}) are found. This helps to eliminate repetitive tag markers ({% and %}) in theme files.


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

{% if collection.image.size != 0 %}
{% assign collection_image = collection.image %}
{% elsif collection.products.first.size != 0 and collection.products.first.media != empty %}
{% assign collection_image = collection.products.first.featured_media.preview_image %}
{% else %}
{% assign collection_image = nil %}
{% endif %}

{%- liquid
if collection.image.size != 0
assign collection_image = collection.image
elsif collection.products.first.size != 0 and collection.products.first.media != empty
assign collection_image = collection.products.first.featured_media.preview_image
else
assign collection_image = nil
endif
-%}

LiquidTag:
enabled: true
min_consecutive_statements: 5
ParameterDescription
enabledWhether this check is enabled.
min_consecutive_statementsThe maximum (inclusive) number of consecutive statements before the check recommends a refactor.

Anchor to Disabling this checkDisabling this check

This check is safe to disable.


Was this page helpful?