Skip to content

Instantly share code, notes, and snippets.

@hartviglarsen
Created April 24, 2018 08:44
Show Gist options
  • Save hartviglarsen/076725d3749aaaff3912c63d23dc8490 to your computer and use it in GitHub Desktop.
Save hartviglarsen/076725d3749aaaff3912c63d23dc8490 to your computer and use it in GitHub Desktop.
Umbraco breadcrumbs
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using ContentModels = Umbraco.Web.PublishedContentModels;
@{
Layout = null;
var crumbs = Model.Content
.Ancestors()
.Where(x => x.IsVisible())
.OrderBy("Level");
}
<div class="breadcrumbs">
@foreach (var crumb in crumbs) {
<a href="@crumb.Url">@crumb.Name</a>
<span>&gt;</span>
}
<a href="@Model.Content.Url">@Model.Content.Name</a>
</div>
@RenderBody()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment