Menu doesn't render inside entry context?
I'm still investigating this other question and as part of that I'm back and forth looking at what the template debug is giving me and what I'm trying to access.
One thing that I'm seeing now though is that, when inside of #entry, I'm able to use #allEntries, even though that's declared outside the scope of entry. The docs mention searching for parent keys so I suspect that is why. However, when I try to do the same for #menu, nothing is rendered if I'm inside #entry, even though menu/allEntries exist at the same json level and are outside of entry.
Is this a bug or intended behavior? I'd definitely like #menu to be used inside of an entry, especially given that I need entry metadata.
menu
is also a property of each entry
, as well as of your site (see the Developer reference). This is why it doesn't render as you expect inside the {{#entry}}
context.
To sidestep this issue, you can close the context and re-open it inside your template file:
{{#entry}}
<h1>{{title}}</h1>
{{{body}}}
{{/entry}}
{{#menu}}
<a href="...">...</a>
{{/menu}}
{{#entry}}
All tags: {{#tags}}...{{/tags}}
{{/entry}}
Answered 7 months ago ยท
Edit answer