Карта сайта. xml с для мультиязычности не отображается правильно в браузере? - PullRequest
0 голосов
/ 06 марта 2020

Создание файла Sitemap на нескольких языках:

В соответствии с инструкциями Google от:

https://support.google.com/webmasters/answer/189077?hl=en

ЭТОТ КОД:

<?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>

РЕЗУЛЬТАТЫ В (ОБРАЩЕНЫ В БРАУЗЕРЕ):

enter image description here

ЭТО КОД (С 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>

РЕЗУЛЬТАТЫ В (ОТКАЗАНО В БРАУЗЕРЕ):

enter image description here


ВОПРОС

Кажется, что нет никаких ошибок. Но странно, что он не отображает XML «страницу» как обычно в браузере.

Этот https://www.google.com/gmail/sitemap.xml от Google также, кажется, ведет себя так же (вы можете проверьте его и убедитесь, что ответ содержит кучу тегов xhtml:link.

Я делаю что-то не так или это нормальное поведение при добавлении этих тегов xhtml:link?

...