v9.38.0
Add comments to a Liquid template using an inline tag. Text enclosed in an inline comment tag will not be printed.
Input
Anything inside an inline comment tag will not be printed.
{% # this is an inline comment %}
But every line must start with a '#'.
{%
# this is a comment
# that spans multiple lines
%}
Output
Anything inside an inline comment tag will not be printed.
But every line must start with a '#'.
Inline comments are useful inside liquid
tags too.
{% liquid
# required args
assign product = collection.products.first
# optional args
assign should_show_border = should_show_border | default: true
assign should_highlight = should_highlight | default: false
%}
But they don’t work well for commenting out blocks of Liquid code. The comment
block tag is the better option when you need to temporarily stop other tags from being executed.
Input
{%- # {% echo 'Welcome to LiquidJS!' %} -%}
{% comment %}{% echo 'Welcome to LiquidJS!' %}{% endcomment %}
Output
-%}