Expand my Community achievements bar.

Generating XML Sitemaps with HREFLANG Tags


Level 1

Is there a solution for automatically generating XML sitemaps containing hreflang tags or available thru a partner/3rd party service?

12 Replies


Level 10

Can you explain your use case in more detail please. Not sure what you want to accomplish.




I do not know if AEM have OOTB for this.

But if you need to add manually , then

    HrefLang tag that goes within the <head> section of the page source code.

    Few examples of how the hreflang tag would be implemented on the site/page:
        <link rel=”alternate” hreflang=”en-gb” href=”http://www.mysite.co.uk”/> //(for .co.uk sites)

        <link rel=”alternate” hreflang=”en-us” href=”http://us.mysite.com”>    // (Google US)

        <link rel=”alternate” hreflang=”en-au” href=”http://www.mysite.com/au/”>   //Google Australia:

For Free tools, please have a look at this article:-


//he use of rel=”alternate” hreflang=”x” within XML Sitemaps w/ FREE TOOL

Link:- http://www.stateofdigital.com/hreflang-sitemap-tool/

//Hreflang Sitemap Tool for Multilanguage & Multinational Websites

I hope this would be of some help to you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni


Level 1

This is a good manual solution I think he is looking for a more scalable solution. There is a need to reference other pages that are equivelent, but in a different language/geo. I, too, am looking for a dynamically created hreflang tag on page and in an XML file


Level 1

SEO requirements for Hreflang make this an important use case, and I hope Adobe Experience team looks at this.
To augment what Jeff wrote, HTML hreflang is a challenge to do sitewide (not to mention it's additional html on a page)
This is a quick guide about how to build an XML sitemap with hreflang tags, but this is not specific to a CMS, and AEM doesn't appear to have documentation on this:  https://ahrefs.com/blog/hreflang-tags/


Level 7

I didn't got your question correctly?

Do you want to generate seperate sitemap.xml based on locale that hreflang detects?

Or just to all all locale url to sitemap.xml?

By default sitemap that is generated by aem consist of all the pages that are activated. If you want to customize it then you need to override OOTB sitemap component and get the hreflang from the locale browser and then generate sitemap.


Level 3
                 It is and OOTB sitemap feature? Not the ACS one.


Level 3
  There is an OOTB sitemap feature? ***


Former Community Member

Possibly worth noting that A1 Sitemap Generator can crawl multi-language websites. When building the XML sitemap, it will try to determine which pages are language variations and automatically include hreflang information in the XML sitemap file as well.


Level 1

Hi @jason_lax ,


Did you found any solution for the issue you were facing to automatic generate hreflang tags through the XML sitemap?



Went through lot of forums/articles for a better/scalable solution. Sitemap generator works all fine in 6.5.11+ and CS instances. However, few customers prefer on the page href lang generation to sitemap.xml.


Proposed Solution:

For the href lang generation in the view-source of a page, I tried using this API and it works like a charm! In the process of assessing the performance issues, esp. when the page is loading for the first time, subsequent requests are cached anyways.  


Regardless of the MSM setup,  PageTreeSitemapGenerator pulls all the alternate language links. Only prerequisite is to have unique jcr:language correctly populated in the language roots.


something like this in your Model/OSGI service shall work  before you iterate through the map in HTL. 


private PageTreeSitemapGenerator pageTreeSitemapGenerator;
alternateLanguageLinks = pageTreeSitemapGenerator.getAlternateLanguageLinks(currentPage);



Level 2

Is there any way to include the link " name " authored in Spanish or Portuguese to get included in the hreflang? 


Because the same site with the same name in the URL is only collected from the sitemap generator and displayed in the alternate languages of hreflang and leaves the sites name which is authored in a different language with the same English alphabets.