Thanks for showing the right direction and I move a step forward with the following code:
{{ range site.Menus.main -}}
{{ if ( $.Page.IsMenuCurrent "main" .) ( $.Page.HasMenuCurrent "main" .) }}
<a id="nav-trigger" class="icon-btn" href="{{ .URL }}"><span>{{ .Pre }}</span></a>
{{ end }}
{{ end }}
It displays the icon of the current section when I am on the section list but not when I am on an article within the given section. I would like to use as a partial to display the current section icon for any post or section.
a long range of menues in every page will slow down the generation.
I use the following to show icons depending of the content type, same way for sections
Not sure about this, but regarding your original attempted solution, maybe you were trying to access the .Pre tag of the parent menu item, which was outside of the current scope? Can you share the full code?
@pmm
Hi,
I made the repository public to allow access to the full code theme.
To be found here
Please note that the partial is topbar.html and I put it on top of single and list layouts.
Be indulgent since I am neither a coder nor a web pro.
The test site itself is build and deployed through Netlify and can be seen here