2

We have implemented multisite & multilingual Sitecore implementation and now we are going to implement new website which will support 4 languages. Sitecore8.1 in use. Code base( VS solution) & Sitecore instance is common for all these sites.

Existing sites

  <!--Site-1: US-->
        <site name="site1-us"
        hostName="www.site1.com"
        virtualFolder="/" 
        physicalFolder="/" 
        language="en" 
        rootPath="/sitecore/content/Site1" 
        startItem="/" 
        database="${Sites.WebDatabase}"
        domain="extranet" 
        allowDebug="true" 
        loginPage="/profile/login.aspx" 
        cacheHtml="${Sites.CacheHtml}" 
        htmlCacheSize="1000MB" 
        registryCacheSize="0" 
        viewStateCacheSize="0" 
        xslCacheSize="5MB" 
        filteredItemsCacheSize="2MB" 
        enablePreview="true" 
        enableWebEdit="true" 
        enableDebugger="true" 
        removeTrailingSlashes ="true"
        enableTracking="true"
        disableClientData="false"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        EnableGeoIPSiteResolver="true" 
        Favicon="" 
        Custom="true"
        linkProvider="languageEmbedded"
        itemwebapi.mode="Off"
        itemwebapi.access="ReadOnly"
        itemwebapi.allowanonymousaccess="false"
        patch:after="site[@name='modules_website']"
                    pagesToRedirect="/experience"/>


      <!--Site-1: UK-->
        <site name="site1-uk"
        hostName="www.site1.com"
        virtualFolder="/" 
        physicalFolder="/" 
        language="en-GB" 
        rootPath="/sitecore/content/Site1" 
        startItem="/" 
        database="${Sites.WebDatabase}"
        domain="extranet" 
        allowDebug="true" 
        loginPage="/profile/login.aspx" 
        cacheHtml="${Sites.CacheHtml}" 
        htmlCacheSize="1000MB" 
        registryCacheSize="0" 
        viewStateCacheSize="0" 
        xslCacheSize="5MB" 
        filteredItemsCacheSize="2MB" 
        enablePreview="true" 
        enableWebEdit="true" 
        enableDebugger="true" 
        removeTrailingSlashes ="true"
        enableTracking="true"
        disableClientData="false"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        EnableGeoIPSiteResolver="true" 
        Favicon="" 
        Custom="true"
        linkProvider="languageEmbedded"
        itemwebapi.mode="Off"
        itemwebapi.access="ReadOnly"
        itemwebapi.allowanonymousaccess="false"
        patch:after="site[@name='site1-us']"
                    pagesToRedirect="/experience"/>

      <!--Site-1: AU-->
        <site name="site1-au"
        hostName="www.site1.com"
        virtualFolder="/" 
        physicalFolder="/" 
        language="en-AU" 
        rootPath="/sitecore/content/Site1" 
        startItem="/" 
        database="${Sites.WebDatabase}"
        domain="extranet" 
        allowDebug="true" 
        loginPage="/profile/login.aspx" 
        cacheHtml="${Sites.CacheHtml}" 
        htmlCacheSize="1000MB" 
        registryCacheSize="0" 
        viewStateCacheSize="0" 
        xslCacheSize="5MB" 
        filteredItemsCacheSize="2MB" 
        enablePreview="true" 
        enableWebEdit="true" 
        enableDebugger="true" 
        removeTrailingSlashes ="true"
        enableTracking="true"
        disableClientData="false"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        EnableGeoIPSiteResolver="true" 
        Favicon="" 
        Custom="true"
        linkProvider="languageEmbedded"
        itemwebapi.mode="Off"
        itemwebapi.access="ReadOnly"
        itemwebapi.allowanonymousaccess="false"
        patch:after="site[@name='modules_website']"
                    pagesToRedirect="/experience"/>


      <!--Site-1: CA-->
        <site name="site1-ca"
        hostName="www.site1.com"
        virtualFolder="/" 
        physicalFolder="/" 
        language="en-CA" 
        rootPath="/sitecore/content/Site1" 
        startItem="/" 
        database="${Sites.WebDatabase}"
        domain="extranet" 
        allowDebug="true" 
        loginPage="/profile/login.aspx" 
        cacheHtml="${Sites.CacheHtml}" 
        htmlCacheSize="1000MB" 
        registryCacheSize="0" 
        viewStateCacheSize="0" 
        xslCacheSize="5MB" 
        filteredItemsCacheSize="2MB" 
        enablePreview="true" 
        enableWebEdit="true" 
        enableDebugger="true" 
        removeTrailingSlashes ="true"
        enableTracking="true"
        disableClientData="false"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        EnableGeoIPSiteResolver="true" 
        Favicon="" 
        Custom="true"
        linkProvider="languageEmbedded"
        itemwebapi.mode="Off"
        itemwebapi.access="ReadOnly"
        itemwebapi.allowanonymousaccess="false"
        patch:after="site[@name='site1-us']"
                    pagesToRedirect="/experience"/>

URL: http://www.site1.com/en http://www.site1.com/en-GB http://www.site1.com/en-AU http://www.site1.com/en-CA

      <!--Site-2: en-IE-->
        <site name="site2"
        hostName="www.site2.com"
        virtualFolder="/" 
        physicalFolder="/" 
        language="en-IE" 
        rootPath="/sitecore/content/Site2" 
        startItem="/" 
        database="${Sites.WebDatabase}"
        domain="extranet" 
        allowDebug="true" 
        loginPage="/profile/login.aspx" 
        cacheHtml="${Sites.CacheHtml}" 
        htmlCacheSize="1000MB" 
        registryCacheSize="0" 
        viewStateCacheSize="0" 
        xslCacheSize="5MB" 
        filteredItemsCacheSize="2MB" 
        enablePreview="true" 
        enableWebEdit="true" 
        enableDebugger="true" 
        removeTrailingSlashes ="true"
        enableTracking="true"
        disableClientData="false"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        EnableGeoIPSiteResolver="true" 
        Favicon="" 
        Custom="true"
        itemwebapi.mode="Off"
        itemwebapi.access="ReadOnly"
        itemwebapi.allowanonymousaccess="false"
        patch:before="site[@name='site1-us']"
                    pagesToRedirect="/experience"/>


      <!--Site-2: en-TT-->
        <site name="site2-tt"
        hostName="www.site2.com"
        virtualFolder="/" 
        physicalFolder="/" 
        language="en-TT" 
        rootPath="/sitecore/content/Site2" 
        startItem="/" 
        database="${Sites.WebDatabase}"
        domain="extranet" 
        allowDebug="true" 
        loginPage="/profile/login.aspx" 
        cacheHtml="${Sites.CacheHtml}" 
        htmlCacheSize="1000MB" 
        registryCacheSize="0" 
        viewStateCacheSize="0" 
        xslCacheSize="5MB" 
        filteredItemsCacheSize="2MB" 
        enablePreview="true" 
        enableWebEdit="true" 
        enableDebugger="true" 
        removeTrailingSlashes ="true"
        enableTracking="true"
        disableClientData="false"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        EnableGeoIPSiteResolver="true" 
        Favicon="" 
        Custom="true"
        itemwebapi.mode="Off"
        itemwebapi.access="ReadOnly"
        itemwebapi.allowanonymousaccess="false"
        patch:after="site[@name='site1-us']"
                    pagesToRedirect="/experience"/>

URL: http://www.site2.com (Language embedding is not there for this site)

rootPath="/sitecore/content/Site3" startItem="/" --> This support one language en-NZ.

URL: http://www.site3.com

New WebSite

<!--Site4 - US-->
    <site name="site4-us"
            hostname="www.site4.com"
                virtualFolder="/" 
                physicalFolder="/" 
                language="en" 
                rootPath="/sitecore/content/Site4" 
                startItem="/" 
                database="${Sites.WebDatabase}"
                domain="extranet" 
                allowDebug="true" 
                loginPage="/profile/login.aspx" 
                cacheHtml="${Sites.CacheHtml}" 
                htmlCacheSize="1000MB" 
                registryCacheSize="0" 
                viewStateCacheSize="0" 
                xslCacheSize="5MB" 
                filteredItemsCacheSize="2MB" 
                enablePreview="true" 
                enableWebEdit="true" 
                enableDebugger="true" 
                removeTrailingSlashes ="true"
                enableTracking="true"
                disableClientData="false"
                enableItemLanguageFallback="true"
                enableFieldLanguageFallback="true"
                Favicon="" 
                Custom="true"
                itemwebapi.mode="Off"
                itemwebapi.access="ReadOnly"
                itemwebapi.allowanonymousaccess="false"
                patch:after="site[@name='site1-us']"
                pagesToRedirect="/experience"/>

URL: http://www.site4.com/en http://www.site4.com/en-GB http://www.site4.com/en-AU http://www.site4.com/en-CA

Is it possible to have this configuration possible? I added the above site4 in sites.config, but since the languages are similar to Site1. Now depending on how I patch it, --> patch:after="site[@name='site1']" , Site1 is rendered for both Site1 and Site4 --> patch:before="site[@name='site1']" , Site4 is rendered for both Site1 and Site4.

Are there any suggestions for the above issue? Is it possible to have multi-domain sites but with same languages?

  • Yes, it is possible, your patching is incorrect. Update your question and share the config patches that you are using. – jammykam May 7 '18 at 20:44
  • @jammykam: I've added the patches now and updated it. – Ashita May 7 '18 at 21:34
2

Your configs are very messy and repetitive, this makes them somewhat more difficult to work with. You can clean them up by making use of the inherits property and setting some "defaults" on a base site config. You can then "override" the setting on your specific site entry.

You have also defined the same site multiple times, only changing the language attribute on each repetition... you don't need to do this, you only need to define the site once and set the default language for the site. Sitecore does not care about the language per site, it will always try to resolve it and return content on that language, instead it cares about the request domain name and trying to match that to the hostName attribute. Your code should handle generation of the links to switch language.

A sample config for multi-site resolving is as follows:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">>
  <sitecore>
    <sites>
      <site
        name="website"
        Favicon="" 
        Custom="true"
        pagesToRedirect="/experience"
        EnableGeoIPSiteResolver="True"
        loginPage="/profile/login.aspx"
        enableItemLanguageFallback="true"
        enableFieldLanguageFallback="true"
        removeTrailingSlashes="true" />

      <site 
        name="site1"
        inherits="website"
        hostName="www.site1.com"
        language="en" 
        rootPath="/sitecore/content/Site1" 
        startItem="/" 
        linkProvider="languageEmbedded"
        patch:after="site[@name='modules_website']" />

      <site name="site2"
        hostName="www.site2.com"
        inherits="website"
        language="en-IE" 
        rootPath="/sitecore/content/Site2" 
        startItem="/" 
        patch:after="site[@name='site1']"/>

      <site name="site3"
        hostName="www.site3.com"
        inherits="website"
        language="en-NZ" 
        rootPath="/sitecore/content/Site3" 
        startItem="/" 
        EnableGeoIPSiteResolver="False"
        patch:after="site[@name='site1']"/>

      <site name="site4"
        hostName="www.site4.com"
        inherits="website"
        language="en" 
        rootPath="/sitecore/content/Site4" 
        startItem="/"
        linkProvider="languageEmbedded"
        EnableGeoIPSiteResolver="False"
        patch:after="site[@name='site1']"/>
    </sites>
  </sitecore>
</configuration>

For ease of inheritance, I've define the base site as website and added the custom attributes to this site (from your config), and the defined each site only once setting the default language to serve content if none is specified (or the language cookie is not set). Each site can also override any attributes from the base site definition.

If you have a separate config per site then split the above config up as required, the config for each site remains the same and unchanged.

  • Thank you @jammykam, I'm working on trying your suggestions and will update this once it works as expected. – Ashita May 8 '18 at 15:51
0

Another way around is the language fallback feature that can cater this requirement.

check this, it will work like this.

enter image description here

for complete documentation, follow this reference link

https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/language_fallback/language_fallback

0

I have found one scenario where I did have to define the site more than once for each language, and that is if they share the same starting item but have different hostNames. This was necessary so that SiteResolving in the Link Provider worked properly. For example:

<site name="site1"
    inherits="website"
    hostName="www.site1.com"
    language="en" 
    rootPath="/sitecore/content/Site1" 
    startItem="/" 
    patch:before="site[@name='website']" />
<site name="site1ES"
    inherits="website"
    hostName="www.site1.com"
    language="es" 
    rootPath="/sitecore/content/Site1" 
    startItem="/" 
    patch:before="site[@name='website']" />
<site name="site1CA"
    hostName="ca.site1.com"
    inherits="website"
    language="en-CA" 
    rootPath="/sitecore/content/Site1" 
    startItem="/" 
    patch:before="site[@name='website']" />
<site name="site1CAFR"
    hostName="ca.site1.com"
    inherits="website"
    language="fr-CA" 
    rootPath="/sitecore/content/Site1" 
    startItem="/" 
    patch:before="site[@name='website']" />

However, this can easily be avoided by having a different starting path for each domain.

  • The above can be compacted down to 2 <site> entries, site1ES and site1CAFR would never actual match. – jammykam May 9 '18 at 2:44
  • Cross-site links did not render properly in this scenario without the extra site definitions. Instead it rendered the links as www.site1.com/fr-ca for example, when we need it to be ca.site1.com/fr-ca. This is in Sitecore 8.2. – Melanie May 9 '18 at 17:18
  • Sure, but I stated you could remove the additional language sites (site1ES and site1CAFR), not site1CA which would be required for the subdomain. – jammykam May 9 '18 at 18:20
  • Without those extras, the other languages did not render to the appropriate subdomain. site1CA handled en-CA, but it didn't know where fr-CA should go so it would end up www.site1.com/fr-ca instead of ca.site1.com/fr-ca like we wanted it. This was only an issue because we had the same tree for multiple subdomains and languages. – Melanie May 10 '18 at 20:18
  • AFAIK Sitecore does not take the language into account when resolving a site, the LanguageResolver is a separate pipeline processor. Maybe you had something custom or a different issue, but OOTB I have never needed to duplicate site configs like this on any of the multilingual sites I have ever worked on. – jammykam May 10 '18 at 20:29

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.