相关疑难解决方法(0)

未定义链接上的名称空间前缀xhtml - sitemap.xml

我正在尝试将语言添加到我的sitemap.xml文件中,但是我得到"未定义链接上的名称空间前缀xhtml"错误.我该如何定义它?我在谷歌上找不到任何有用的东西.

这是文件:

<?xml version="1.0" encoding="UTF-8"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
  <url>
    <loc>https://www.leepio.dk/</loc>


</urlset>
Run Code Online (Sandbox Code Playgroud)

xml sitemap

9
推荐指数
1
解决办法
6028
查看次数

用于多语言的 &lt;xhtml:link rel="alternate" hreflang="" href=""/&gt; 的 Sitemap.xml 无法在浏览器上正确呈现?

生成多种语言的站点地图:

按照 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>
Run Code Online (Sandbox Code Playgroud)

结果(在浏览器中呈现):

在此输入图像描述

此代码(带有xhtml:link标签):

<?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>
Run Code Online (Sandbox Code Playgroud)

结果(在浏览器中呈现):

在此输入图像描述


问题

似乎没有任何错误。但奇怪的是它没有像往常一样在浏览器中呈现 XML“页面”。

来自 Google的 https://www.google.com/gmail/sitemap.xml似乎也具有相同的行为(您可以检查它并看到响应包含一堆xhtml:link标签)。

我做错了什么还是添加这些标签时的正常行为xhtml:link

xml sitemap multilingual hreflang

6
推荐指数
0
解决办法
3253
查看次数

XML Sitemap呈现为纯文本

我有一个XML Sitemap,在浏览器中访问时需要正确呈现。

请参见下面的代码。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<urlset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
http://www.w3.org/1999/xhtml http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"   
>
<url>
    <loc>https://www.brideonline.ru/_____PassioanteLady.html</loc>
    <xhtml:link rel="alternate" hreflang="ru-us" href="https://www.brideonline.ru/profile.php?Language=Russian&#038;ID=_____PassioanteLady&#038;Language1=1"/>
    <changefreq>monthly</changefreq>
    <priority>0.1</priority>
</url>
<url>
    <loc>https://www.brideonline.ru/___Alisa___.html</loc>
    <xhtml:link rel="alternate" hreflang="ru-us" href="https://www.brideonline.ru/profile.php?Language=Russian&#038;ID=___Alisa___&#038;Language1=1"/>
    <changefreq>monthly</changefreq>
    <priority>0.1</priority>
</url>
</urlset>
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试在浏览器上访问它时,它仅显示为纯文本。

非常感谢任何帮助/解释为何将其呈现为纯文本。

谢谢。

xml sitemap

2
推荐指数
1
解决办法
935
查看次数

标签 统计

sitemap ×3

xml ×3

hreflang ×1

multilingual ×1