Copied to clipboard

Flag this post as spam?

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


  • Jeremy Newman 18 posts 190 karma points
    Sep 27, 2016 @ 18:03
    Jeremy Newman
    0

    I am combining several sites into one which share the same membership type and data to keep from custom synchronization code. So I have multiple root nodes with different layouts and the same doc types. I believe I understand how this works when I deploy to the server and actually have multiple IP's/dns names but what about dev? I have had to resort to setting umbracoHideTopLevelNodeFromPath to false and...

    To elaborate I tackled the site template issues as follows in the child templates:

    var site = Model.Content.AncestorOrSelf(1).Name;
    Layout = string.Format("~/Views/{0}/SiteLayout.cshtml", site);
    

    All of the templates point to a layout page that has no layout info just some base css and js require calls. By convention I have a folder under views named the same as the root site node and having a SiteLayout.cshtml page under it.

    • ~/Views/Site1/SiteLayout.cshtml
      • Layout = "~/Views/SiteLayout.cshtml"
    • ~/Views/Site2/SiteLayout.cshtml
      • Layout = "~/Views/SiteLayout.cshtml"
    • etc...
    • ~/Views/SiteLayout.cshtml (RootMaster)

    Now the issue is everywhere that a relative url was hard coded in the html. I tried using @Url.Content("/") which doesn't do what I need so the only thing I can think of is adding a helper method that basically does the same as the above and appends the url to the closest root ancestor.

    @Url.MultiSiteUrl("/")
    

    Any tips or suggestions. Maybe I am missing an obvious answer here? Am I completely barking up the wrong tree?

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Sep 28, 2016 @ 13:19
    Dennis Adolfi
    100

    Hi Jeremy.

    Maybe I haveĀ“nt fully understood the question, but am i right that you have several root-sites in one installation and you need to link to the root from your templates? Could you use @Model.Content.Site().Url instead?

  • Jeremy Newman 18 posts 190 karma points
    Sep 28, 2016 @ 15:21
    Jeremy Newman
    1

    Thank you Dennis

    Yep. Somehow missed the site method. That is exactly what I need in the templates.

    I was also looking for validation of my approach to working with multiple sites. Sorry the post was so confusing.

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Sep 28, 2016 @ 17:44
    Dennis Adolfi
    0

    Glad i could help! Your approach looks valid to me. :)

    Have a great day Jeremy!

Please Sign in or register to post replies

Write your reply to:

Draft