Contact us

Sitemap xml Multiple Languages Support with Sitecore SXA

Technical Leader
Valtech, India

October 02, 2018

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 need any customization- see the Sitecore SXA 1.6 release notes here for reference, 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-2.png

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

Happy learning!

 

Article was originally published on Ankit Joshi's Sitecore blog: Sitemap xml multiple languages with support with Sitecore SXA 

Contact us

We would love to hear from you! Please fill out the form and the nearest person from office will contact you.

Let's reinvent the future