Skip to content

Instantly share code, notes, and snippets.

@amirkhan81
Created June 17, 2019 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirkhan81/b2d1f7135277043faf6283779a7795bb to your computer and use it in GitHub Desktop.
Save amirkhan81/b2d1f7135277043faf6283779a7795bb to your computer and use it in GitHub Desktop.
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Umbraco.Web
@*
This snippet displays a list of links of the pages immediately under the top-most page in the content tree.
This is the home page for a standard website.
It also highlights the current active page/section in the navigation with the CSS class "current".
*@
@{ var selection = Model.Content.Site().Children.Where(x => x.IsVisible()).ToArray(); }
@if (selection.Length > 0)
{
<ul>
@foreach (var item in selection)
{
<li class="@(item.IsAncestorOrSelf(Model.Content) ? "current" : null)">
<a href="@item.Url">@item.Name</a>
</li>
}
</ul>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment