Skip to content

capture tag

  • The Capture tag sets the value of a named variable by rendering the content with the tag’s block.

Example: {% raw %}

{% assign favorite_food = "pizza" %}
{% assign age = 35 %}
{% capture about_me %}
I am {{ age }} and my favorite food is {{ favorite_food }}.
{% endcapture %}
{{ about_me }}

{% endraw %} Output:

I am 35 and my favorite food is pizza.