Skip to content

Developers · Liquid

Liquid Tags: Theme

Last updated 1 November 2026

Write many Liquid tags in one block with liquid, and print from inside it with echo.

The theme tags make long Liquid easier to write. liquid holds many tags inside one pair of delimiters, and echo prints a value from inside that block. Use them for logic-heavy partials, where repeating {% and %} on every line makes the code hard to read.

liquid

Write one tag per line, with no delimiters of their own:

{% liquid
  case section.blocks.size
    when 1
      assign column_size = ''
    when 2
      assign column_size = 'one-half'
    else
      assign column_size = 'one-quarter'
  endcase
%}

echo

echo prints a value, the same as {{ }}, but it works inside a liquid block and takes filters.

insites-cli exec liquid docs57 "{% liquid
assign name = 'mike'
echo name
echo 1 | plus: 1
%}"
mike2

This ran on the docs.insites.io instance on 1 November 2026. echo adds no space or line break, so the two values run together.

TagUse it to
liquidWrite several tags in one block, one per line
echoPrint a value, with filters, inside that block

Comments inside the block

Inside a liquid block, start a line with # to make it a comment. A %} inside such a comment no longer closes the block. A comment tag also works, with comment and endcomment each on its own line. Written on one line, the instance reports that the comment tag was never closed.

Use liquid for partials that are mostly logic, such as a function that builds a value and returns it. Keep plain {% %} tags in templates that are mostly HTML, where the markup is easier to read.

Common mistakes

  • Writing two tags on one line inside the block. Every tag, including a comment and its end, needs its own line.
  • Using {{ }} inside the block. Use echo instead.
  • Expecting echo to add spacing. Print a space or a tag yourself.