{% 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.
In a zola project I had the following:
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 looppage
to something different solved the issue.However, I found it weird that a missing
page.extra.menuLabel
would fall back to the globalpage
variable. My expectation would have been that thepage
variable from thefor
loop would override the full object/struct ofpage
. Or, would raise a conflict of a duplicate name. But not "mix" those structs.