欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

网站优化

百度搜索引擎手机端XML站点地图示例代码

网站优化 我的站长站 2025-02-13 共43人阅读

Baidu的<mobile:mobile>是对标准sitemap协议的扩展,命名空间为:http://www.baidu.com/schemas/sitemap-mobile/1/,有以下四种取值:

<mobile:mobile/>:移动网页

<mobile:mobile type="mobile"/>:移动网页

<mobile:mobile type="pc,mobile"/>:自适应网页,代表页面会适配不同屏幕尺寸,但是网址不变。

<mobile:mobile type="htmladapt"/>:代码适配,服务端会返回不同的代码以适配不同的客户端环境,但是用户访问的网址不变

示例:

<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
       xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">
   <url>
       <loc>http://m.example.com/index.html</loc>
       <mobile:mobile type="mobile"/>
       <lastmod>2009-12-14</lastmod>
       <changefreq>daily</changefreq>
       <priority>0.8</priority>
   </url>
   <url>
       <loc>http://www.example.com/index.html</loc>
       <lastmod>2009-12-14</lastmod>
       <changefreq>daily</changefreq>
       <priority>0.8</priority>
   </url>
   <url>
       <loc>http://www.example.com/autoadapt.html</loc>
       <mobile:mobile type="pc,mobile"/>
       <lastmod>2009-12-14</lastmod>
       <changefreq>daily</changefreq>
       <priority>0.8</priority>
   </url>
   <url>
       <loc>http://www.example.com/htmladapt.html</loc>
       <mobile:mobile type="htmladapt"/>
       <lastmod>2009-12-14</lastmod>
       <changefreq>daily</changefreq>
       <priority>0.8</priority>
   </url>
</urlset>