This project is read-only.

Keep the blog menu item selected when viewing blog posts

Topics: Customizing Orchard, General
Aug 18, 2013 at 11:28 PM
How can I make it so that the menu item I have added for a blog stays selected when viewing its blog posts? Right now the blog link in the menu is only selected when viewing the list of posts.
Aug 19, 2013 at 9:11 AM
Edited Aug 19, 2013 at 9:13 AM
There is probably an easier way but, you might in some way render the url of the related blog menu item in a hidden tag (you might add a part to blog post content type or create an alternate view in your theme) , and an HTML widget which contains a jQuery script to find the hidden blog url, loop through the links in the menu, add "current" CSS class to the containing <li>. The widget should be added to a layer with rule ContentType("BlogPost") so that it will only run a blog post itself is displayed in detail. ContentType layer rule is available in version 1.7, and should be available in the module gallery for 1.6.
Aug 21, 2013 at 4:21 PM
I just wrote a MenuItem alternate and put my code for selecting the active trail there.
When it's part of the trail just add the "current" class to it.