Legacy Knowledge Base
Published Jul. 2, 2025

Sitemap Index: hreflang attribute with value "x-default"

Written By

Phil Chapman

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

Our DXP site has English (United Kingdom) as its default language. For the Liferay sitemap, shouldn't it be expected to see the "en-GB" value associated with the hreflang attribute as per this example?

<url>
<loc>http://localhost:8080/page1</loc>
<lastmod>2021-09-26T06:6:30+00:00</lastmod>
<changefreq>daily</changefreq>
<xhtml:link href="http://localhost:8080/zh/page1" hreflang="zh-CN" rel="alternate"/>
<xhtml:link href="http://localhost:8080/page1" hreflang="en-GB" rel="alternate"/>
<xhtml:link href="http://localhost:8080/in/page1" hreflang="in-ID" rel="alternate"/>
<xhtml:link href="http://localhost:8080/vi/page1" hreflang="vi-VN" rel="alternate"/>
<xhtml:link rel="alternate" hreflang="en-GB" href="http://localhost:8080/page1"/>
</url>

Environment

  • DXP 7.3  

Resolution

  • The configuration hreflang="x-default" is expected here as per below:

<url>
<loc>http://localhost:8080/page1</loc>
<lastmod>2021-09-26T06:6:30+00:00</lastmod>
<changefreq>daily</changefreq>
<xhtml:link href="http://localhost:8080/zh/page1" hreflang="zh-CN" rel="alternate"/>
<xhtml:link href="http://localhost:8080/page1" hreflang="en-GB" rel="alternate"/>
<xhtml:link href="http://localhost:8080/in/page1" hreflang="in-ID" rel="alternate"/>
<xhtml:link href="http://localhost:8080/vi/page1" hreflang="vi-VN" rel="alternate"/>
<xhtml:link rel="alternate" hreflang="x-default" href="http://localhost:8080/page1"/>
</url>
  • "x-default" is a special language key for search engines. Additionally, the sitemap contains an alternative for the en-GB flag under the alternate URLs.

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base