Generating a Sitemap with multiple languages:
Following Google instructions from:
https://support.google.com/webmasters/answer/189077?hl=en
THIS CODE:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://www.example.com</loc>
<lastmod>${formattedDate}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>
RESULTS IN (RENDERED IN THE BROWSER):
THIS CODE (WITH THE xhtml:link
TAGS):
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://www.example.com</loc>
<lastmod>${formattedDate}</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
<xhtml:link rel="alternate" hreflang="en-us" href="https://www.example.com"/>
<xhtml:link rel="alternate" hreflang="en-ca" href="https://ca.example.com"/>
<xhtml:link rel="alternate" hreflang="en-gb" href="https://uk.example.com"/>
</url>
</urlset>
RESULTS IN (RENDERED IN THE BROWSER):
QUESTION
There does not seem to be any errors. But it's weird that it doesn't render the XML "page" as usual in the browser.
This https://www.google.com/gmail/sitemap.xml from Google also seems to have the same behavior (you can inspect it and see that the response contains a bunch of xhtml:link
tags).
Am I doing anything wrong or is it the normal behavior when you add those xhtml:link
tags?