Weird behavior with duplicate variable names
In a zola project I had the following:
{% set pages = get_section(path="projects/_index.md") %}
{% for page in pages.pages %}
<li><a class="link-body-emphasis" href="{{ page.path | safe }}">{{ page.extra.menuLabel | default(value=page.title) }}</a></li>
{% endfor %}
The result was was all of those menu entries had the extra.menuLabel of the current page. Not of the page from the for loop.
I quickly figured out that page was a global variable and that renaming the for loop page to something different solved the issue.
However, I found it weird that a missing page.extra.menuLabel would fall back to the global page variable. My expectation would have been that the page variable from the for loop would override the full object/struct of page. Or, would raise a conflict of a duplicate name. But not "mix" those structs.
However, I found it weird that a missing page.extra.menuLabel would fall back to the global page variable
Hu weird, it shouldn't?