Thanks for the workaround. I do agree that the documentation is not clear or the code is not working for single pages.
The docs and example for
sectionPagesMenu works for Home (/), and sections (e.g. /posts/) and section pages (e.g. /posts/my-post-title/) but not for something like (/about/).
The docs for
.IsMenuCurrent https://gohugo.io/functions/ismenucurrent/#readout states:
.IsMenuCurrent is a method in
Page object returning a boolean value. It returns
true if the PAGE is the same object as the
.Page in MENUENTRY in a given MENU.
Why then does a menu entry for
/about/ not return true for the page
/about/? I tried to troubleshoot but I got a bit lost in the codebase.
@joshmorel Here’s one solution to this
Thanks for sharing @zwbetz
I must not know how to discourse. Why was my reply created as a separate thread and not just a reply to .IsMenuCurrent returns false for single pages?
I moved it. Since that thread was already marked as solved, I moved your question to a new thread, and linked the old thread.
Ah okay thanks for the explanation. I thought I did something weird.