当前位置

移动手机网站的网站地图 (Mobile Web Sitemap)

James Qi 在 2011年12月30日 - 10:04 提交

  9月份在搭建我们的第一个适合智能手机、平板电脑的移动版本网站“手机版邮编库”的时候,我们根据Google移动网站地图的规范,对Drupal自动生成的xmlsitemap进行了相应的人工修改,提供给搜索引擎抓取。昨天再次查看这个手机版本邮编库网站地图时,发现10月份这个地图进行了自动更新,生成的新地图没有人工修改来符合Google移动网站地图规范,于是今天早上再次修改,并将一些要点记录如下。

  外部资料链接:

  移动网站地图例子:

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

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0">
<url><loc>http://www.google.com/xhtml</loc><lastmod>2004-10-01T23:05:32+00:00</las...<mobile:mobile/></url>
<url><loc>http://www.google.com/xhtml/en-help.html</loc><lastmod>2004-09-30T22:10:...<mobile:mobile/></url>
<url><loc>http://www.google.com/xhtml/ja-help.html</loc><lastmod>2004-10-01T23:05:...<mobile:mobile/></url>
<url><loc>http://www.google.com/wml?site=local</loc><mobile:mobile/></url>
<url><loc>http://www.google.com/wml/help</loc><mobile:mobile/></url>
<url><loc>http://www.google.com/chtml/doc.html</loc><mobile:mobile/></url>
<url><loc>http://www.google.com/sprint3g/help.html</loc><mobile:mobile/></url>
</urlset>

  从上面的例子看,与普通的sitemap相比较,就是有两个地方不同:

  1. 一是在开头的urlset中添加了xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"
  2. 二是在每个url中添加了<mobile:mobile/>

  从上面的说明来看,移动网站地图其实与普通网站地图的区别很小,只要我们稍微改动一点就可以了。我们在Drupal中也另外做了设置,不让这个被我们人工改动的地图自动更新,免得在不知情时被覆盖。