If you need to share code between Templates, you can define snippets in the Snippets page.
The name you give a Snippet is how you will refer to it later on in your Templates.
Let's define two snippets:
Snippet: user-name
{%- if userName -%}
{%- else -%}
{%- endif -%}
Snippet: items-list
{%- for item in list -%}
{%- endfor -%}
You can then load them in a Template like follows:
{%- load_snippets 'user-name', 'items-list' -%}
<p>Hello {% include 'user-name', userName: "Jane Doe" %}</p>
{% include 'items-list', list: user.groceries %}
Copy link