I assume that you're using Partial View Macros, if so I think this snippet do what you´re after. If you are using Razor Macro DynamicNode let me know and I will try to help you. But based onthecodethat youhave posted, it seemsto methat you are usingMVC
razor syntax for OrderBy
display as the breadcrumbs Home > Category > Sub category,
I want get Sub category > Category > Home.
change the code
@foreach (var page in CurrentPage.Ancestors().OrderBy("Level"))
or
@foreach (var page in CurrentPage.Ancestors().OrderBy("Level desc"))
It didnt achieve.rendered HTML not any change!
How can i do? thanks!
Hi Meng,
If you want to display like this Home > Category > Sub Category
@using umbraco.MacroEngines; @using umbraco.BusinessLogic @inherits umbraco.MacroEngines.DynamicNodeContext @{ DynamicNode n = new DynamicNode(); List<DynamicNode> page = @Model.Ancestors().Where("Visible").Where("level > 1").Items; <ul> @foreach(var item in page){ if(r.NodeTypeAlias =="homepageDocType"){ <li><a href="/">Home</a></li> } else{ var altUrl = (r.ChildrenAsList.Where(x=>x.GetProperty("umbracoNaviHide").Value != "1")? r.ChildrenAsList.First().Url : r.Url; <li class="current"><a href="@altUrl">@r.Name</a></li> } } <li class="current">@CurrentModel.Name</li> </ul> }Hi Meng,
I assume that you're using Partial View Macros, if so I think this snippet do what you´re after. If you are using Razor Macro DynamicNode let me know and I will try to help you. But based on the code that you have posted, it seems to me that you are using MVC
The code snippet above should give you a breadcrumb that looks like this: Sub category > Category > Home.
Hope this helps,
/Dennis
Hi Meng,
Dennis's snippet is correct and can be used directly in a view or partial view or a macro partial view.
Did you try it?
Jeavon
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.