Umbraco Razor List Random Pages from a specific node from anywhere on the site and exclude by Node Type Alias

@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var siteInfoPage = @Model.NodeById(1064);

<h3><a href="@siteInfoPage.Url" title="@siteInfoPage.pageNavigationName">Popular Pages</h3>
<ul>


@foreach (var thisPage in @Model.NodeById(1064).Descendants().Where("visible && NodeTypeAlias != \"Faq\"").Random(7))
{
  <li><a href="@thisPage.Url">@thisPage.pageHeadingName</a></li>
}

</ul>
}

Comments

Post a Comment

Popular posts from this blog

Umbraco - Reset the Admin Password via SQL Server

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

Umbraco Macro for IFrame when Embedding Video, Vimeo Universal Player, or other types of IFrame on to a Page XSLT version and Razor Version