Search code examples
umbracoumbraco7

Get root node of Umbraco 6 multi site install


How do you get the root home node of the current site in an Umbraco 6 Multi site install?

The structure is this:

Content
  --Home1
    --About
    --Contact
  --Home2
    --About
    --Contact
  --Home3
    --About
    --Contact

Solution

  • var root = Model.Content.AncestorOrSelf("[YourHomeNodeDocumentType]");
    

    I'm not sure if this is Umbraco 6 syntax, but what you want is that AncestorOrSelf traveersing call. I have many multi-site-multi-lingual setups and I use that all the time. The "or self" portion is fun, in some cases that "root" node is a page.