Umbraco multi-site site with shared content

If I have 1 Umbraco installation with 4 websites, is it possible to share content between sites?

Or is it better to create another site ("repository") that will have all the content and allow other sites to fetch / link content from that "repository" website?

+3


source to share


2 answers


There was a nice session this year at CountryWide's Umbraco CodeGarden which might be worth watching as it discussed a group in the housing market that has about "40+ different high traffic sites from one Umbraco install" but shared content between many of sites in the group. You can watch the video here:

http://stream.umbraco.org/video/9921509/40-different-high-traffic-sites-from-a



I would recommend watching the entire video, but if you can't go 25 minutes to watch this discussion thread. They have a common content node (+ children).

Simon

+8


source


I would recommend that you stick to existing websites and not create a repository website. This makes it easier, I think, to define canonical URLs for documents if they are to appear across multiple websites. Also makes it clearer from a content editor's point of view. To reach content from another site, I would use code like this (considering Umbraco 7+ here):

// Root nodes
var root = Umbraco.TypedContentAtRoot().First();
var site = Model.Content.AncestorOrSelf("Site");
var lang = Model.Content.AncestorOrSelf("LanguageHome");

var allOtherWebsites = root.Children.Where(x => x.Id != site.Id);
var newsFromAllOtherWebsites = allOtherWebsites.Descendants("News").Where(x => x.Parent.Name.ToLowerInvariant() == lang.Name.ToLowerInvariant());

// Do things with news...

      



I also added something for multilingual installation, you can just uninstall them if you don't need it.

Hope this helps!

+1


source







All Articles