I am having a Sitecore SXA (1.5) instance site which has multiple language for each country. For example:
www.mysite.be/fr-BE
(Country: Belgium, Lang: French)
www.mysite.be/nl-BE
(Country: Belgium, Lang: Dutch)
But the sitemap.xml
shows only urls which have the default language setup without any language id in the URL
Example here is my sitemap.xml
output:
<url>
<loc>www.mysite.be/onze-producten</loc>
<lastmod>2018-12-12</lastmod>
<changefreq>Daily</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>https://www.mysite.be/over-merk</loc>
<lastmod>2018-12-12</lastmod>
<changefreq>Daily</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>https://www.mysite.be/contacteer-ons</loc>
<lastmod>2018-12-11</lastmod>
<changefreq>Daily</changefreq>
<priority>0.5</priority>
</url>
But it doesn't shows pages related to French language. For example:
www.mysite.be/fr-be/contactez-nous
www.mysite.be/fr-be/faq
If this is a custom implementation, please guide.
EDIT:
As per the answer below I tried making this to work, but no luck:
public class CustomSiteMap : SitemapGenerator
{
protected override StringBuilder BuildSitemap(IEnumerable<Item> childrenTree, SitemapLinkOptions options)
{
var items = LanguageSitemap.GetSitemapItems();// gets all items below Home node
var xDocument = LanguageSitemap.Generate(items); // generates sitemap xml with hreflang and language specific urls
return new StringBuilder(xDocument.ToString());
}
}