Sitecore Weekly Tips – Tip 4: fill in the Target Hostname field for a correct sitemap.xml for your SXA site

Recently I was asked by one of our developers why the URL’s in the sitemap.xml file where changing based on the hostname used to visit the site. If we entered the site with all the URL’s in the sitemap.xml started with But when we entered the site without the www part, so with, all the URL’s in the sitemap.xml file changed to that one.

So you would end up with one site with unique pages but accessible from different URL’s and also a sitemap.xml that tells search engines the same thing. From a SEO perspective that is not what you want.

Luckily I learned that SXA has a thought about it. In the site settings part there is a field to enter a Target Hostname. Once filled in the sitemap.xml only uses this value regardless the hostnames with which you can access the site. Follow these simple steps and make your SEO consultants happy :).

  1. Go to /sitecore/content/Tenant Folder/Tenant/Site name/Settings/Site Grouping/Site name and look for the Target Hostname field.
  2. Fill in the hostname which you want to use in the sitemap.xml, save the change and publish it.
  3. Now check your sitemap.xml via multiple hostnames to check.