Skip to content

capture

Captures the output inside a block and assigns it to a variable

Example:

liquid
{% assign brand = 'YouCan' %}
{% capture foo %}Hello from {{- brand -}}{% endcapture %}
{{ foo }}

Output

html
Hello from YouCan