Sitemap xml multiple languages support with Sitecore SXA

When working with multilingual websites you might want to tell google about localized versions of your pages so that it helps google to point users to the most appropriate version of your page by language or region, you can find more details about this here.

If you are already into Sitecore SXA 1.6-  the feature is inbuilt and doesn’t needs any customization- see the Sitecore SXA 1.6 release notes here for ref., but if you haven’t upgraded yet you have to write some custom code to support this configuration/feature.

In this case what we have to do here is:

  1. Create a new class that inherits from SitemapGenerator (part of Sitecore.XA.Feature.SiteMetadata )
  2. Override BuildSitemap() method.

You can write your own code under BuildSitemap() method and generate the customized sitemap.xml to support multiple languages.

Once you make this change- you will see sitemap.xml in the below format (below example shows three language versions of home page)

sitemap-multilang

Hope this helps and you can use this solution until you move to SXA 1.6.

Happy learning 🙂

Configure Sitecore to update sitemap xml on CM and CD servers

In a scalable environment the expectation is to have multiple servers serving the content(s) to different regions(or sometime same region as well), the typical architecture is to have one content management server and atleast one content delivery server.

Sitecore provides “Sitemap XML module“, when we publish content(s) it will generate an updated Sitemap.xml file – basically, a listing of page(s) that a web-crawlers can use to crawl and index a site.

sitemapxml

When we have content delivery servers set up as part of the configuration, we have to make sure that Sitemap.xml file also gets updated to CD servers which doesn’t happen by default, only content management file gets updated.

In order to make sure we Sitemap.xml file getting updated to the servers, we have to add following  to events section:

<event name=”publish:end:remote”>
<handler type=”Sitecore.Modules.SitemapXML.SitemapHandler, Sitemap.XML” method=”RefreshSitemap” />
</event>

This will updated the Sitemap.xml file in content delivery servers as well.

Note: Please refer this URL which explains about the same issue and resolution-

https://www.captechconsulting.com/blogs/sitecore-sitemap-shared-source-module-configuing-for-scaled-environments

Happy learning 🙂