@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
    This snippet makes a list of links to the of parents of the current page using an unordered html list.

    How it works:
    - It uses the Ancestors() method to get all parents and then generates links so the visitor can go back
    - Finally it outputs the name of the current page (without a link)
*@

@{ var selection = CurrentPage.Ancestors(); }

@if (selection.Any())
{
    <ul>
        @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@
        @foreach (var item in selection.OrderBy("Level"))
        {
            <li><a href="@item.Url">@item.Name</a> &raquo;</li>
        }

        @* Display the current page as the last item in the list *@
        <li>@CurrentPage.Name</li>
    </ul>
}
