Google Sitemap Problem

蓝咒 提交于 2019-12-11 01:26:54

问题


I submitted a sitemap to Google and I got this error.

Incorrect namespace Your Sitemap or Sitemap index file doesn't properly declare the namespace. Expected: http://www.google.com/schemas/sitemap-image/1.1 Found: http://www.sitemaps.org/schemas/sitemap-image/1.1

I thought that sitemaps.org was okay. I took it from Google's example:

Google's sitemap example

What am I doing wrong? Any ideas?


回答1:


Have you tried replacing

http://www.sitemaps.org/schemas/sitemap-image/1.1

with

http://www.google.com/schemas/sitemap-image/1.1

since that seem to be problem?

If you have and that didn't help, can you post your sitemap here? Include just a few url tags.

Update: This page may be of use: http://www.sitemaps.org/protocol.php. It's where I started when I wrote my first sitemap.

Another thought: In case you don't link directly to images or videos but only to html pages or php pages, you probably can remove

xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1"

and

xmlns:video="http://www.sitemaps.org/schemas/sitemap-video/1.1

I'm not using that code in my sitemap, and it works as it should.




回答2:


Hello, Actually the solution was replacing this:

<sitemapindex xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9/ https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">

With this:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

And it works as expected and Google sitemap can be able to read the file.

Thank you




回答3:


XML namespaces are used for providing uniquely named elements and attributes in an XML document.

Name conflicts in XML can easily be avoided using a name prefix.

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/"> <html> <body>   <h2>My CD Collection</h2>  
<table border="1">
    <tr>
      <th style="text-align:left">Title</th>
      <th style="text-align:left">Artist</th>
    </tr>
    <xsl:for-each select="catalog/cd">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>   </table> </body> </html> </xsl:template>

</xsl:stylesheet>


来源:https://stackoverflow.com/questions/3794940/google-sitemap-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!