0

I am using Sitecore 9.0.1 with SXA 1.7. We have created one site where the languages used are "zh-CN" and "en" and configured the site to use virtual folder "/cn". When we browse for sitemap it shows the language code after the domain name and after that, it shows the virtual folder directory.

enter image description here

I would like the virtual folder to come first and then the language code. Can anyone please suggest is this expected behavior in SXA if we use the Virtual folder concept? If not please suggest how to make it right?

Thank you

0

If you take a look at the post https://stackoverflow.com/questions/49009555/multi-regional-and-language-sites-sitecore it states that this is the default sitecore behavior of displaying the urls when virtual folder and language embedding are set.

Sitecore SXA uses a method GetFullUrl which renders the urls in the sitemap, if you take a look at the existing implementation of the SitemapGenerator service in Sitecore.XA.Feature.SiteMetadata.dll:

protected virtual string GetFullLink(Item item, SitemapLinkOptions options)
{
  string itemUrl = LinkManager.GetItemUrl(item, options.UrlOptions);
  return options.Scheme + Uri.SchemeDelimiter + options.TargetHostname + itemUrl;
}

For the rel="alternate" links the GetFullUrl method is called with these options:

  UrlOptions urlOptions2 = (UrlOptions) urlOptions1.Clone();
  urlOptions2.LanguageEmbedding = LanguageEmbedding.Always;

If you want to customize your sitemap urls you can implement your own sitemap generator which will inherit from SXA SitemapGenerator service and override the GetFullUrl method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.