Featured Post
Sitecore Error Troubleshooting: Sitecore Multisite Multilingual Hostname Resolving Error
- Get link
- X
- Other Apps
Problem Statement:
The Sitecore Experience Platform provides facility to configure multiple website on single Sitecore instance, and most of us using Sitecore for multitenant and multisite. In one of the Sitecore implementation we were using Single Sitecore instance to setup multiple site with multi-lingual support.
For each Sitecore site, we were having multiple languages url to support different languages site like this in following order:
The Sitecore Multi site hierarchy looks like:
As explained above, we were having multiple languages for single website contosocorp, so we were using Language Selector to redirect user to language specific Sitecore website:
From Language selector, if user select English language, then user should redirect to contosocorp.com website and if user select Japanese language then user should redirect to ja-contosocorp.com website.
For language selector to get actual site url we were using Sitecore Site Configuration details like this:
var siteQuery = "//sites/site[@language='" + languageName + "' and starts-with(@rootPath, '" + siteRootPath + "')]";
For example, at runtime, it passes the language as en and siteRootPath as /sitecore/content/contoso corp then it needs to return the english url of constoso corp as contosocorp.com but it was returning as contosocorp2.com.
We were getting wrong site url from Sitecore Site Definition Configuration site, due to this user was redirecting to wrong site.
To identify the root cause of error Wrong Site name being resolved, we:
Compared the Sitecore Site Definition Configuration details with other environments Sitecore Site Definition Configuration details
The code which returns the language specific url was working in multiple websites but was not working correctly for one of the Sitecore Site in multisite multilingual environment and we were wondering what went wrong 😊😟
At the end we found that there was issue in resolving Site details in Multisite Multilingual scenario for the English version of contosocorp website.
The written code was trying to find Site node for contosocorp English version in Sitecore Site Definition Configuration file with the help of root path string "/sitecore/content/contoso corp" but it was returning contosocorp2 English version Site node because first Site node which matched the root path string "/sitecore/content/contoso corp" was "/sitecore/content/contoso corp2", and belongs to contosocorp2 not contosocorp.
The order of Site configuration details in Sitecore Site Definition Configuration file, naming convention of site node in Sitecore Content Tree and the way we were trying to resolve the site name created the issue:
To correct the issue, we loaded the Site configuration details for english version of contosocorp2 website after the english version of contosocorp website in Sitecore Site Definition Configuration file with this, code able to match the first instance of "/sitecore/content/contoso corp" as an english version of contosocorp website:
After adjusting the order of Site nodes in Sitecore Site Definition Configuration files, code started returning the correct Site node:
The Digital Marketers/Business Users/Content Author always wanted the flexibility while
creating Content Item, and this is genuine ask, but as an IT Team we have to educate them
by explaining the best practices for creating new content items and some are:
- Get link
- X
- Other Apps
Comments