Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin 278 posts 661 karma points
    Aug 13, 2018 @ 13:31
    Martin
    0

    Multisite - Root Home Node

    Hi All,

    I'm at the beginning of building a multi-site structure in Umbraco Cloud.

    I've ran into the problem of setting the root node of each multi-site, where my navigation is going to the root of the Umbraco instance and not the "Home" node of each site.

    • Brand One
      • Home - hostname - brand-one.com
        • About
    • Brand Two
      • Home - hostname - brand-two.com
        • About

    I want to be able to set the root node of the site on the home page. Is there a best practice to set the root to the home node?

    @{
        var site = Model.Content.Site();
    }
    <ul>
        <li><a href="@site.Url">@site.Name</a></li>
        @foreach(var node in site.Children) 
        {
            <li><a href="@node.Url">@node.Name</a></li>
        }
    </ul>
    

    Thanks

    Martin

  • Dave Woestenborghs 3233 posts 10957 karma points MVP 5x admin c-trib
    Aug 13, 2018 @ 13:49
    Dave Woestenborghs
    1

    Hi martin,

    What you can do is the following

    var site = Model.Content.AncestorOrSelf("homePageDocTypeAlias")
    

    You will need to replace homePageDocTypeAlias with the actual alias of your homepage doctype.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft