Skip to main content

Posts

Showing posts from June, 2014

Umbraco Razor List Pages of a Certain Type from Anywhere in the site

The following script takes a look through all the nodes in the umbraco structure, and lists all the nodes of a certain type: (in this case "FAQ"s - good for Front Page News) @inherits umbraco.MacroEngines.DynamicNodeContext     @foreach (var thisPage in @Model.Descendants("Faq").Take(5))     {       <li style="text-align:left;"><a href="@thisPage.Url" style="color:#ffffff">@thisPage.Name</a></li>     }   To Sort by the updated date: @inherits umbraco.MacroEngines.DynamicNodeContext         @foreach (var thisPage in @Model.Descendants("Faq") .OrderBy("UpdateDate descending").Take(5))     {       <li style="text-align:left;"><a href="@thisPage.Url" style="color:#ffffff">@thisPage.Name</a></li>     }  Output: