I would like to have a function block that I can assign the content within the block to a variable, but I can find a way to do so. I have used macros but the problem I that I cant return html content within the block. Below is what I intend to achieve:
{%- capture variableName %}
<section>
{% for row in rows %}
<div>
name: {{ row.name }}
</div>
{% endfor %}
</section>
{%- endcapture %}
so I call within the template where I have the above block or a template within its scope
{% capture variableName %}
the content in the block should be assigned to variableName. How can I go about achieving this?