Files
Umbraco-CMS/src/Umbraco.Web.UI/umbraco/scripting/templates/cshtml/Breadcrumb.cshtml

24 lines
822 B
Plaintext

@inherits umbraco.MacroEngines.DynamicNodeContext
@*
This snippet makes a breadcrumb of parents using an unordred html list.
How it works:
- It uses the Ancestors() method to get all parents and then generates links so the visitor get go back
- Finally it outputs the name of the current page (without a link)
*@
@if (Model.Ancestors().Any())
{
<ul class="breadcrumb">
@* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@
@foreach (var page in Model.Ancestors().OrderBy("Level"))
{
<li><a href="@page.Url">@page.Name</a> <span class="divider">/</span></li>
}
@* Display the current page as the last item in the list *@
<li class="active">@Model.Name</li>
</ul>
}