I need to populate breadcrumb navigation with the data I defined inside set breadcrumb
. So, my code looks like this:
Breadcrumb items:
{% set breadcrumb = [{ name : 'Item name 1'}, { name : 'Item name 2'}, { name : 'Item name 3'}] %}
And the loop looks like this:
<nav>
<ul>
{% for item in breadcrumb %}
<li>
<span>{{name}}</span>
</li>
{% endfor %}
</ul>
</nav>
But, the output is half-working. I get the <li>
elements, but no Name. Just empty <span>
.
<nav>
<ul>
<li>
<span></span>
</li>
<li>
<span></span>
</li>
<li>
<span></span>
</li>
</ul>
</nav>
Something with {{name}}
is not ok, but I don't understand what.