get all of document type umbraco with razor
10,819
This simple razor macro should accomplish what you desire:
@{
// Get root node:
var root = Model.AncestorOrSelf();
// Get all descendants, filter by type:
var nodes = root.Descendants("info");
// Loop through the filtered nodes, displaying the properties:
<ul>
@foreach (var node in nodes)
{
<li>
<h2>@node.infoTitle</h2>
<div>@node.infoSummary</div>
<div>@node.infoBody</div>
</li>
}
</ul>
}
Author by
LeBlaireau
Updated on June 10, 2022Comments
-
LeBlaireau almost 2 years
I have a document type of "info" I also have some custom properites.
infoTitle infoSummary infoBody
I want to retrieve all the documents of document type "info" and output the data.
Thanks