Possible Bug in Core.Navigation 1.5.1

Topics: Core, Customizing Orchard, Troubleshooting, Writing themes
Sep 1, 2012 at 3:35 PM

It looks like the Core.Navigation will not render any item (on the same level or not) that has the same title text and is the same type - it doesn't render the second item.  If the title text is the same; but one item is a Content Menu Item and the other is a Custom Link - they both render.

Another scneario is if I have two menu items with the same title text and pointing to the same content item - the second will not render, but if I change the title text of the second item - it will then render.

It should be noted that in the Admin - everything renders fine and it shows all the proper positions and everything; but when rendering to the user/site - it removes what it thinks is duplicates.

How/Why is it doing this and how can I stop it?

My particular menu scenario does have duplicate Content Menu Items under certain other Menu Items; and I need those second items to keep the same title text and pointing to the same item.

I've looked across all the core.navigation razor files and didn't see where this "filtering" was taking place.

Any help would be appreciated.

thanks

Sep 1, 2012 at 4:53 PM

I discovered that it was the Merge function within the NavigationManager.cs (more specifically that GroupBy being used to group same menus) that was causing my problem.

I modify NavigationManager.cs to no longer perform that GroupBy and it seems to have addressed it.  What is the purpose of that GroupBy - What's the scenario that would exist that someone would create same menus in the UI of the Admin but NOT want it to render?

Any insight would be greatly appreciated; I want to make sure that this doesn't break again after an update.  After making that change - the only other problem that I ran into (mentioned in the issues) was that a recompile of Core.Navigation causes a problem with the ClaySharp library with the "Replace" not found; more specifically I have to add "ToString()" to some of the objects being references (e.g. Href.Replace() because Href.ToString().Replace() - leads me to belive that there's a version of ClaySharp out there that supports the ToString() override so that it's done automatically.

thanks

Sep 1, 2012 at 6:12 PM

So Removing the GroupBy causes duplicate Admin menu items in the Orchard Navigation on the left; so now that I know the Group By should exist; how can I override the Merge for my menu navigation and put back the original Merge?

thanks