My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and ...

Sitecore Error Troubleshooting: Sitecore Multisite Multilingual Hostname Resolving Error

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.

Solution:

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

Debugged the code
Tried many combinations of Sitecore Site Definition Configuration

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:

The item name should be in lower case
There should be no space in item name
If space required in item name, then replace space with hyphen sign
Utilize display name property to provide name with spaces
Always provide meaning full name to item and don’t use 1 or 2 at the end of item name


Credit/References:


Pingback:

Sitecore headless example Sitecore jss installation sitecore helix principles
Sitecore 9 Performance Tuning Sitecore jss graphql example sitecore jss sample app
sitecore sxa multisite configuration What is SXA Page Design? SXA Query Builder
What is SXA Partial Design? Benefits of SXA Sitecore JSS React
Sitecore Content Migration Using Sitecore Express Migration Tool Sitecore Upgrade Process sitecore upgrade
Sitecore Multisite Architecture Manage multiple sites with the SXA Site Manager Configuring Multiple Sites with Sitecore
How do I configure Sitecore to serve multiple sites? Working with multiple sites Add a Managed Web Site to the Sitecore ASP.NET CMS
multi site configuration in sitecore how to create a new website in sitecore sitecore site definition config
sitecore patch web config Sitecore multi-site subdomain Sitecore context site properties
Sitecore Sites How to create new website in SItecore site attribute properties
Sitecore Site Definition Attributes Configuring a Site in a Multi-site Solution Should targetHostName and hostName be the same
Determining website context Sitecore multisite cross links not resolved with proper hostname what is sitecore multisite
sitecore sxa multisite configuration sitecore multisite configuration sitecore multisite best practices
sitecore multisite robots.txt sitecore multi site analytics sitecore jss multisite
sitecore helix multisite multisite in sitecore sitecore 404 page multisite
sitecore multisite setup sitecore 10 multisite sitecore 9 multisite configuration

Comments

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Manager Cloud (XM Cloud) Building blocks

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container