From your example, I take it you are using webforms razor?
Ok, this is for MVC Razor, but the logic should remain true, you will need to adapt it slightly;
@{
var root = CurrentPage.AncestorOrSelf();
var nodes = root.Descendants().Where("Visible");
}
<ul>
@{
foreach (var d in nodes)
{
<li>(@d.Level) @d.Name</li>
}
}
</ul>
The difference should be the "getting" of the root, ie establish this as an entity first. This returns true down to level 4 on my current development.
For a simple breadcrumb navigation, @CurrentPage.Up().NiceUrl() gives the desired links, but again this is in MVC Razor so will need to be adapted for Webforms.
Hope this helps, sorry not in Webforms, but it just shows how flexible Umbraco is, use what you prefer, fantastic!
When building breadcrumb two different levels get the same node.Level value
I have this weird problem. I'll try to explain.
I'll start with my site's content tree:
The razor code in breadcrumb.cshtml:
This is a very simple breadcrumb navigation.
The problem is that this outputs as the following:
See the problem?
I output the level after the name, and i get level (2) for both the second and third items.
Some more info:
I found this with u4.10 that moving documents in the tree didn't update the level in the db.. I had to go in manually and correct
since updating to 4.11.1 I've not seen that, I think is was an issue that was fixed around moving items....
Maybe you moved some items prior to the update to 4.11???
Nope, my first install of Umbraco was 4.11
Hi Rob
From your example, I take it you are using webforms razor?
Ok, this is for MVC Razor, but the logic should remain true, you will need to adapt it slightly;
@{
var root = CurrentPage.AncestorOrSelf();
var nodes = root.Descendants().Where("Visible");
}
<ul>
@{
foreach (var d in nodes)
{
<li>(@d.Level) @d.Name</li>
}
}
</ul>
The difference should be the "getting" of the root, ie establish this as an entity first. This returns true down to level 4 on my current development.
For a simple breadcrumb navigation, @CurrentPage.Up().NiceUrl() gives the desired links, but again this is in MVC Razor so will need to be adapted for Webforms.
@gary, i'm sorry but the problem is not building the breadcrumb.
I now know that it probably is a bug in umbraco. (See this issue)
But i don't think there is a fix for v4 yet. :(
Hi Rob,
Apologies if I misunderstood -
Ok, just moved a node up the tree, republished entire site and yes, the level remained as it was before in both V6 and V4.11.1
então, concordamos.
G
is working on a reply...