It would be @CurrentPage.AncestorOrSelf(1).Descendants("docTypeAlaias")
This would return all of the nodes from the root node of the site being rendered, if you had multiple root nodes (sites) and wanted all nodes from all sites, then there would be a different solution.
Umbraco.TypedContentAtRoot() will return you a collection of all the level 1 nodes, if you want only certain Document Types in this collection, then Umbraco.TypedContentAtRoot().OfTypes("myFirstDocType", "mySecondDocType");
umbraco.library:GetXmlAll() razor version
Hi guys
I am currently working on converting all my old XSLT files to Razor. My scenario is the following:
I need to fetch all nodes of a specific doctype. Not from currentpage. In XSLT I would do it like this:
umbraco.library:GetXmlAll()//doctypeAliasHere
My question is, how do I do it in razor? :)
/Michael
Hi Michael,
It would be
@CurrentPage.AncestorOrSelf(1).Descendants("docTypeAlaias")
This would return all of the nodes from the root node of the site being rendered, if you had multiple root nodes (sites) and wanted all nodes from all sites, then there would be a different solution.
Jeavon
Hi Jeavon
My umbraco structure looks like this:
Homepage- SubpagesLanguage version- Hompage-- SubpagesLanguage version 2- Homepage-- SubpagesI need something to fetch all the language version doctypes.
Michael
Hi Michael,
So they are all siblings under the root node?
Jeavon
Umbraco.TypedContentAtRoot()
will return you a collection of all the level 1 nodes, if you want only certain Document Types in this collection, thenUmbraco.TypedContentAtRoot().OfTypes("myFirstDocType", "mySecondDocType");
Hi Jeavon
Sorry for not getting back to you. Been a busy summer :)
I will check your solution out this weekend when i get some playtime :)
Thanks
/Michael
Hi again Jeavon
That did the trick. Thank you very much :)
/Michael
Great!
is working on a reply...