I'm using Razor and the DynamicNode and DynamicNodeList. I can easily find the site root for the current node using .AncestorOrSelf(). But I'd like to get a list of all other site roots.
Looking at the XML in ~/App_Data/umbraco.config I can see that the site root is actually not a root node in the XML, it's the first child of the actual root node (called 'Root') in the XML, and all other site roots are its siblings. But there is no Siblings() method on DynamicNode. I tried .XPath("following-siblings") but it's empty.
Hi. "following-sibling" (not 'siblingS') is an xpath axis, so if you want to use it then the correct syntax would be 'following-sibling::*'. Actually why not to use the .Children collection of the topmost root itself?
Create a list of site roots
I'm using Razor and the DynamicNode and DynamicNodeList. I can easily find the site root for the current node using .AncestorOrSelf(). But I'd like to get a list of all other site roots.
Looking at the XML in ~/App_Data/umbraco.config I can see that the site root is actually not a root node in the XML, it's the first child of the actual root node (called 'Root') in the XML, and all other site roots are its siblings. But there is no Siblings() method on DynamicNode. I tried .XPath("following-siblings") but it's empty.
What would be the best way to get all site roots?
Hi. "following-sibling" (not 'siblingS') is an xpath axis, so if you want to use it then the correct syntax would be 'following-sibling::*'. Actually why not to use the .Children collection of the topmost root itself?
Thanks for the tip. I didn't know how to get the CMS Content node (actual root in the XML). Turns out this works:
new DynamicNode(-1)
I found the rest of the solution here:
http://our.umbraco.org/forum/developers/razor/19859-Getting-Rootnode-siblings
is working on a reply...