1. Home
  2. Liquid
  3. Capture

Capture is a very handy Liquid function for assigning structured data to a variable.

#liquid#variable
 {% capture myVar  %}
     {% for item in array  %}
        {{ item.title  }}
     {% endfor  %}
 {% endcapture  %}

 {{ myVar  }}
copy
Full Liquid cheatsheet