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?
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?
Multi-site Implemtentation
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:
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.
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.
Any tips or suggestions. Maybe I am missing an obvious answer here? Am I completely barking up the wrong tree?
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?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.
Glad i could help! Your approach looks valid to me. :)
Have a great day Jeremy!
is working on a reply...