capture tag

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

Example:

{% assign favorite_food = "pizza" %}

{% assign age = 35 %}

{% capture about_me %}

I am {{ age }} and my favorite food is {{ favorite_food }}.

{% endcapture %}

{{ about_me }}

Output:

I am 35 and my favorite food is pizza.