cloudscribe/cloudscribe.Web.Navigation

Breadcrumbs cannot distinguish multiple nav pathways ending at the same target

Closed this issue · 2 comments

If you have multiple navigation nodes (within Navinagtion.xml and/or simplecontent) that resolve to the same target URL, then when you visit that target page you will only ever see the breadcrumbs appropriate to the first of those navigation pathways.

This seems intrinsic to the way the component works - the breadcrumb system does not dynamically "keep track of" your pathway down to a page. Rather, when you visit a page, the nav system infers the breadcrumb path to that page - but it has only one piece of information to go on: the current URL. So it traverses the tree of navigation nodes from Root downwards looking for the first node definition that resolves to that current URL, then back-calculates the breadcrumb path to that node. The first one found always wins. This can be confusing if you arrived at the same target page via a different navigation route.

This will similarly affect the class=active CSS flags that get stamped on the "currently active" nav links in the navbar, such that it will always look as though the first matching nav link is the active one, even if you followed the second.

Notes to self:

CurrentNode.cs
    currentNode = RootNode.FindByUrl(urlHelper, context.Request.Path, nodeSearchUrlPrefix);
(you just have Request.Path to work from) 
>> TreeNodeExtensions  FindByURL >> FindByURLExact delegate seems to be a recursive walk matching the first URL route


NavigationViewModelExtensions > GetClass