0

We are using Sitecore SXA 1.7.1.

The checkbox 'Language Embedding' is set to false for one of our SXA sites and all the site url's are rendering without language code. But, in the sitemap -provided by SXA- all the url's contain the language 'en' which we want to avoid.

We raised a Sitecore support ticket on this but didn't get any reponse yet. Is there a way to get this working in Sitemap as well?

Update:

protected virtual UrlOptions GetUrlOptions()
    {
      UrlOptions defaultUrlOptions = LinkManager.GetDefaultUrlOptions();
      defaultUrlOptions.Site = this.Context.Site;
      defaultUrlOptions.AlwaysIncludeServerUrl = false;
      defaultUrlOptions.SiteResolving = true;
      return defaultUrlOptions;
    }
3

Sitecore has reported this as bug as suggested by @Gatogordo and provided fix for this https://sitecore.app.box.com/s/fzle8isub8ixogpsgfanhdiywifb5ype

2

The sitemap generator uses these UrlOptions:

protected virtual UrlOptions GetUrlOptions()
{
  UrlOptions defaultUrlOptions = LinkManager.GetDefaultUrlOptions();
  defaultUrlOptions.Site = this.Context.Site;
  defaultUrlOptions.AlwaysIncludeServerUrl = false;
  defaultUrlOptions.SiteResolving = true;
  defaultUrlOptions.LanguageEmbedding = LanguageEmbedding.Always;
  return defaultUrlOptions;
}

The LanguageEmbedding.Always is causing your issue. This can be found in Sitecore.XA.Feature.SiteMetadata.Sitemap.SitemapGenerator.

I think it could be fixed as the Generator gets UrlOptions from the SitemapHandler that is calling it (without this hardcoded embedding) but that is an assumption.

7
  • I found attached decompiled code (updated in my question) where there is no code associated with LanguageEmbedding. Will it take by default as 'Always' – Manideep Yechuri Mar 16 '19 at 20:49
  • The code you found is in the handler. The code I gave you is from the generator that is used by the handler and there the embedding is hardcoded. – Gatogordo Mar 16 '19 at 21:06
  • yeah, able to find out the code you mentioned. But, can we fix this through custom coding (like overriding the existing one). Already raised a ticket to Sitecore on this but still awaiting their response. – Manideep Yechuri Mar 16 '19 at 21:17
  • You could try to fix it yourself but I would give this info to Support and ask them for a fix. – Gatogordo Mar 16 '19 at 21:24
  • Thanks for the help. If they are going to give a fix, will it be a new support dll? – Manideep Yechuri Mar 16 '19 at 21:29

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.