我有一个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&ID=_____PassioanteLady&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&ID=___Alisa___&Language1=1"/>
<changefreq>monthly</changefreq>
<priority>0.1</priority>
</url>
</urlset>
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试在浏览器上访问它时,它仅显示为纯文本。
非常感谢任何帮助/解释为何将其呈现为纯文本。
谢谢。
因此,经过数小时的谷歌搜索并进行了大量尝试和错误之后,我设法通过以下链接解决了我的问题:Google多语言站点地图问题
通过更改声明(使用http://www.w3.org/1999/xhtml):
<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">
Run Code Online (Sandbox Code Playgroud)
为此(使用http://www.w3.org/TR/xhtml11/xhtml11_schema.html):
<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/TR/xhtml11/xhtml11_schema.html 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/TR/xhtml11/xhtml11_schema.html">
Run Code Online (Sandbox Code Playgroud)
现在,当在浏览器中访问XML文件时,它现在返回XML格式而不是纯文本。
希望这可以帮助其他有需要的人。:)
| 归档时间: |
|
| 查看次数: |
935 次 |
| 最近记录: |