macros - Breadcrumb not showing in Umbraco Site -
i created partial view macro file in umbraco backoffice breadcrumb. inserted macro masterpage , ran site, couldn't see anthing. no breadcrumb navigation, no errors, jsut nothing. wrong?
please see breadcrumb code below
@inherits umbraco.web.macros.partialviewmacropage @* snippet makes breadcrumb of parents using unordered html list. how works: - uses ancestors() method parents , generates links visitor can go - outputs name of current page (without link) *@ @{ var selection = currentpage.ancestors(); } @if (selection.any()) { <ul class="breadcrumb"> @* each page in ancestors collection have been ordered level (so start highest top node first) *@ @foreach (var item in selection.orderby("level")) { <li><a href="@item.url">@item.name</a> <span class="divider">/</span></li> } @* display current page last item in list *@ <li class="active">@currentpage.name</li> </ul> }
please me out. thanks.
so below standard breadcrumb code use, in partial view sits on master page
@inherits umbracotemplatepage @{ var selection = model.content.ancestors().tolist(); if (selection.any()) { var currentpagetitle = model.content.name; <ul class="breadcrumb"> @foreach (var item in selection.orderby("level")) { var pagetitle = item.name; <li> <a href="@item.url" title="@pagetitle"> @pagetitle </a> </li> } <li class="active"> @currentpagetitle </li> </ul> } }
as mentioned before show on pages under home page see example image of content tree below.
all pages going down , under of them show bread crumb , home page wont (because doesn't have ancestors i.e. first page in tree).
i got feeling content tree not nested 1 above i.e. pages on same level home page, can please add picture of content tree looks like.
Comments
Post a Comment