Excluding language from Sitecore SXA sitemap for non-multilingual site

Recently we faced this issue in our Sitecore SXA site which was non-multilingual but still there was language being embedded in sitemap.xml “alternate” node. Firstly we had ensured that the language embedding settings are properly in-place which are languageEmbedding=”never” and Languages.AlwaysStripLanguage=”false“.

After having these settings in place still we were able to see the language being embedded in sitemap.xml “alternate” node.

After digging into Sitecore Class (Sitecore.XA.Feature.SiteMetadata.Sitemap.SitemapGenerator) responsible for generating the rel=”alternate” node in sitemap and doing some research we found that some-how it does not follow the languageEmbedding option set in the configuration and that was because the method that it was using for generating the url had the object SitemapLinkOptions with languageEmbedding option set to “always” hardcoded in the code itself.

To resolve this issue we had override the GetFullLink method and set the languageEmbedding option to the value that was set through the config (which in this case is “never”).

Following is the code and config file changes that we needed to do.

After doing the above changes the “alternate” node in our sitemap.xml file was getting generated properly with no language being embedded in the url.

That’s all for this and hope this would be helpful for all of you.

Happy Sitecore-ing!

Sitecore xDB Rebuild Index Token Issue

Here we will be seeing the process of rebuild the xDB search index in Solr and a issue associated with index token in it. The reason of rebuilding the xDB came up because when we were looking at the application insights for our site we saw the below exception and the count for it was too high (around 25k in 24 hours).

Exception
“*** [xdb_collection.GetContactFacetsChanges], Line 27. Errno 50000: Sync token is no longer valid for the [ContactFacets] table.”

We knew that we had to rebuild our xDB index in Solr to resolve this issue, so we followed the steps mentioned in the Url. Now when we executed the steps in our UAT environment all went all and we no longer saw the above exception in application insights but when we executed the same in our Prod environment we saw that even if the execution was successful we still were able to see thousands of entries for the above exception.

Summary of steps performed from the above URL.

In Kudu, go to site\wwwroot\App_data\jobs\continuous\IndexWorker and execute this command:

.\XConnectSearchIndexer.exe -rr

After this, we will see that in our inactive / rebuild index it will be first reset to 0, and then counts start gradually increasing. If there are no issue in the execution process you will see a “done” message after execution of the above command in kudu console.

Solr Search Query – Just in case to check the current status of your rebuild index you can execute the following query in your index.

id:”xdb-rebuild-status”

Index Rebuild Status:
Default = 0
RebuildRequested = 1
Starting = 2
RebuildingExistingData = 3
RebuildingIncomingChanges = 4
Finishing = 5
Finished = 6

Now as mentioned above that in our UAT environment we were getting the rebuild status as 6 and also the total documents in the Solr index had updated but the same did not happen in Prod environment. After contacting to Sitecore support they had suggested to remove the following document id:”xdb-index-token” from the Solr and it will be recreated.

Note: Please remove the document from your sitecore_xdb and sitecore_xdb_rebuild core.

Yes this worked for us, this document again got created in the Solr core as told by Sitecore support and rebuild started and we were able to see the documents getting updated in both of xDB cores. Also the application insights was not showing above error any more on our prod environment.

Hope this blog-post serves as an addition to all other posts available on rebuild xDB search index in Solr.

Happy Sitecore-ing!