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>
}
@{
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>
}
how do you use this in a template page?
ReplyDelete