0

Please explain me on what is the usage of Multisite project which is present inside the foundation layer of Habitat architecture.

By default in sitecore.config we can able to add any new sites inside <sites> tag then we can achieve a multiple sites in single Sitecore instance.

Then what is the purpose of the multisite project ? I heard like this project is used to isolate the sites present in SC instance.

I would like to know in more detail from source code perspective as well as from Sitecore item perspective. please clarify in detail?

https://github.com/Sitecore/Habitat/tree/master/src/Foundation/Multisite/code

Thanks in advance

  • 1
    Helix doesn't have a Foundation.Multisite project. Helix is a set of guiding principles. You have referenced Habitat which was an example of Helix. Helix != Habitat. I've edited the question to remove references to Helix. – Richard Seal Feb 20 at 2:17
0

According to the official Helix documentation:

The most important feature in the Foundation/Multisite module is the ability for renderings to define site specific datasources. This means that each site can maintain a list of datasource locations for different renderings – which means that for example teasers does not have to be shared between all tenants in a solution, but only between sites within a tenant.

What it allows is to decouple datasource templates and datasource locations from renderings. It can be achieved by specifying "site:yourdatasource" in rendering's datasource field and then creating yourdatasource items in each site. The screenshot below is taken from Helix documentation.

Helix example of datasource definition

When using Foundation.Mulitisite module you will still need to define sites in sitecore.config as you mentioned. The main goal of the is to separate datasource locations from renderings.

It is possible to define datasource templates and locations for each site, in addition to on the rendering itself. This is done through an extension of the getRenderingDatasource pipeline and the addition of a site: prefix to the Datasource Location field. In short: if the Datasource Location field contains a site: prefix, the pipeline extension will attempt to lookup the datasource location and template in a site specific list.

| improve this answer | |
  • how we can achieve If we want to share a component for 2 sites only in a multi site environment having 5 sites in solution ?. does datasource location field able to add 2 locations of the site ? – Jeyanth Praveenkumar Feb 20 at 6:45
  • @JeyanthPraveenkumar you should be able to have multiple datasource locations by having pipe separated list of locations like described here: firebreaksice.com/sitecore-rendering-datasource-locations – grg Feb 20 at 7:49
3

When you come with Helix principles, you will see some challenges. One of them is to set the datasource Template on rendering. Rendering is being created in the feature layer and datasource template is created under the project layer as well as one rendering can have different datasource locations in multisite. Now as per the helix principle you can not add any reference from the project layer to the feature layer. Multisite project in the foundation layer is resolving this dependency by implementing a getRenderingDatasource processor -

<getRenderingDatasource>
            <processor type="Sitecore.Foundation.Multisite.Pipelines.GetDatasourceLocationAndTemplateFromSite, Sitecore.Foundation.Multisite" patch:after="processor[@type='Sitecore.Pipelines.GetRenderingDatasource.GetDatasourceLocation, Sitecore.Kernel']" />
        </getRenderingDatasource>

enter image description here

enter image description here

This processor looks for the "site" prefix in datasource location and based on it find the Datasource Configuration item and for this item, it set the datasource location and template.

This project also includes multisite:createdatasourcesetting command for creating rendering settings and webedit:openexperienceeditorcommand for fixing of switching to the default site instead of one matched by domain.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.