Search code examples
razorumbracoumbraco8

Can we get the count of created nodes of a specific document type in Umbraco razor view


If i have a node with documenttype alias as "entry", which is created as a child node to many different root and child pages, is there a way to get the total count on created "entry" type nodes and display in razor view in Umbraco?


Solution

  • Yes, of course, for v7 use:

    Model.Content.Site().Descendants("entry").Count()
    

    for v8

    @Model.Root().DescendantsOfType("entry").Count()