我即将创建一个工具来为谷歌创建动态站点地图(并生成一个动态站点地图索引页)。
但是我找不到任何关于如何在站点地图索引URL的信息。我知道它不必以。xml结尾。但是站点地图索引中的站点地图位置是这样的吗?
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.example.com/sitemap1.xml?param1=someParameter¶m2=anotherParameter</loc>
<lastmod>2004-10-01T18:23:17+00:00</lastmod>
</sitemap>
</sitemapindex>
提前感谢。
更新:我们采用了以下解决方案。
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://myhost.com/sitemap1.xml</loc>
<lastmod>2015-01-28</lastmod>
</sitemap>
<sitemap>
<loc>http://myhost.com/sitemap2.xml</loc>
<lastmod>2015-01-29</lastmod>
</sitemap>
</sitemapindex>
Google似乎对此很高兴。至少它可以工作,而且谷歌没有抱怨它。您可能可以添加更多的属性(如果它们在sitemaps.org模式中指定),但它会有多大的差异,我不知道。
创建站点地图时请参考以下规则。http://www.sitemaps.org/protocol.html
具体来说,允许使用包含URL参数的动态URL。但是loc标签中的URL必须是UTF-8编码的
我认为这不会是一个问题,因为Google仍然可以获得附加参数的XML文件。我建议你通过网站管理员工具测试一下,看看它是否有效。提交站点的sitemap,然后等着看页面是否被索引——这可能需要一两天的时间,但如果提交有任何错误或问题,他们会告诉你的。
我有点困惑。站点地图本身的文件名需要是一个XML文件,但是XML文档中的代码应该指向站点的网页,看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.site.com/index.html</loc>
<lastmod>2013-05-02</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.site.com/about.html</loc>
<lastmod>2013-05-02</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>
查看loc标签如何显示html网页。为什么您的loc标记显示xml页面?