dedecms各大搜索引擎移动端适配规则

  • 2
  • 19,381 views
  • A+
所属分类:dede教程

移动端的时代,大部分的dede企业网站的没有考虑过移动端怎么去改版(移动端改版可以参考:手机端仿站),怎么去获得流量,本内容主要内容为百度、360、搜狗、神马等搜索引擎移动适配规则。

从dede的程序分析,可以得出三种链接出来。

  • 首页
  • 列表页
  • 内容页(包含专题页)

三种链接格式出来,两个格式即可。

URL格式(PC链接:https://www.dadongjie.com   移动端链接:https://m.dadongjie.com)

Pattern模式(需要对正则了解个P)

那么对应的首页、列表页直接使用URL格式即可,而内容页因为内容量级的问题,所以只能使用Pattern模式,来匹配链接。

百度移动适配规则

内容页移动适配

站点网址:http://zhanzhang.baidu.com/

  1. #(\w+)代表字符串,(\d+)表示数字
  2. https://www.dadongjie.com/(\w+)/(\d+).html     #对应着:https://www.dadongjie.com/naipingjia/993.html
  3. https://www.dadongjie.com/(\w+)/(\w+)/(\d+).html   #对应着:https://www.dadongjie.com/yuerzhishi/baobaohulizhishi/725.html
  4. #${2} 对应着上面第一条的第二个参数,第二个数字为内容的ID值 ,同理${3}对应的是第三个参数
  5. https://m.dadongjie.com/view.php?aid=${2}    #对应着:https://m.dadongjie.com/view.php?aid=993
  6. https://m.dadongjie.com/view.php?aid=${3}    #对应着:https://m.dadongjie.com/view.php?aid=725

dedecms各大搜索引擎移动端适配规则

列表页适配

因为dede列表页,与移动的无逻辑性的关系,所以就要使用URL的方式提交链接。(当然您说你的移动端做了伪静态,你的PC做了动态就寻其他的方法吧)。

如果只是几个栏目,那么还好处理,如果像待产包最全清单网站130多个栏目,那估计就搞死个人了。看dede仿站里面有一篇这样的内容dede仿站第四课:为了他(她)套上它,可以通过标签获取到栏目的链接,这样就解决了。

  1. #下面注释仅供理解阅读使用,如需使用,请删除注释内容
  2. {dede:channelartlist row=100 typeid='top'}
  3. #获取顶级栏目的链接,以及ID值,pc链接与移动链接中间用空格隔开(百度使用,其他的搜索引擎是TAB间隔)
  4. https://www.dadongjie.com{dede:field name='typeurl'/} https://m.dadongjie.com/list.php?tid={dede:field name='id'/}
  5. #获取顶级栏目下的下级栏目的链接,以及ID值
  6. {dede:channel type='son' noself='true'}
  7. https://www.dadongjie.com[field:typelink/]  https://m.dadongjie.com/list.php?tid=[field:id/]<br>
  8. {/dede:channel}
  9. {/dede:channelartlist}

上述代码可以放在任何一个模板位置上,当然建议还是放在底部,收集到栏目相关链接后,然后就修改过来。

dedecms各大搜索引擎移动端适配规则

剩下的就是提交规则,等到百度审核。

360移动适配

360站长:http://zhanzhang.so.com/

列表页适配

url匹配规则,中间间隔换为tab键,保存为txt文件放置到网站任意目录。

内容页移动适配

与百度的规则无多大区别,只是${2}换成了\2

  1. #(\w+)代表字符串,(\d+)表示数字
  2. https://www.dadongjie.com/(\w+)/(\d+).html     #对应着:https://www.dadongjie.com/naipingjia/993.html
  3. https://www.dadongjie.com/(\w+)/(\w+)/(\d+).html   #对应着:https://www.dadongjie.com/yuerzhishi/baobaohulizhishi/725.html
  4. #${2} 对应着上面第一条的第二个参数,第二个数字为内容的ID值 ,同理${3}对应的是第三个参数
  5. https://m.dadongjie.com/view.php?aid=\2    #对应着:https://m.dadongjie.com/view.php?aid=993
  6. https://m.dadongjie.com/view.php?aid=\3    #对应着:https://m.dadongjie.com/view.php?aid=725

搜狗移动适配

搜狗站长:http://zhanzhang.sogou.com/

列表页适配

搜狗的URL适配跟其他的搜索引擎都不一样,需要是xml格式,且还有一堆参数。

如果你栏目的比较多,那么建议您,看看python的文件操作,这样几百个链接瞬间也可以处理完成。

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- XML文件需以utf-8编码 -->
  3. <urlset>
  4.     <url>
  5.         <loc>https://www.dadongjie.com/</loc>  # PC链接
  6.         <data>
  7.             <display>
  8.                 <url_pattern>https://m.dadongjie.com/</url_pattern> #移动端链接
  9.                 <version>7</version>
  10.             </display>
  11.         </data>
  12.     </url>
  13. # 第二组
  14.     <url>
  15.         <loc>https://www.dadongjie.com/yunmaqingdan/</loc>
  16.         <data>
  17.             <display>
  18.                 <url_pattern>https://m.dadongjie.com/list.php?tid=42</url_pattern>
  19.                 <version>7</version>
  20.             </display>
  21.         </data>
  22.     </url>
  23. #第二组结束,以<url>开头</url>结束
  24. </urlset>

内容页移动适配

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- XML文件需以utf-8编码 -->
  3. <urlset>
  4.     <url>
  5.         <loc>https://www.dadongjie.com</loc> #入口链接
  6.         <data>
  7.             <display>
  8.                 <pc_url_pattern>https://www.dadongjie.com/(\w+)/(\d+).html</pc_url_pattern>
  9.                 <url_pattern>https://m.dadongjie.com/view.php?aid=${2}</url_pattern>
  10.                 <pc_sample>https://www.dadongjie.com/naipingjia/993.html</pc_sample> #符合上述规则的PC链接
  11.                 <wap_sample>https://m.dadongjie.com/view.php?aid=993</wap_sample> #符合上述规则的移动端链接
  12.                 <version>7</version>
  13.             </display>
  14.         </data>
  15.     </url>
  16. # 第二组开始
  17.         <url>
  18.         <loc>https://www.dadongjie.com</loc>
  19.         <data>
  20.             <display>
  21.                 <pc_url_pattern>https://www.dadongjie.com/(\w+)/(\w+)/(\d+).html</pc_url_pattern>
  22.                 <url_pattern>https://m.dadongjie.com/view.php?aid=${3}</url_pattern>
  23.                 <pc_sample>https://www.dadongjie.com/yuerzhishi/baobaohulizhishi/725.html</pc_sample>
  24.                 <wap_sample>https://m.dadongjie.com/view.php?aid=725</wap_sample>
  25.                 <version>7</version>
  26.             </display>
  27.         </data>
  28.     </url>
  29. #第二组结束,以<url>开头</url>结束  
  30. </urlset>

制作完成,保存xml文件格式,上传到网站。

 

神马移动适配

神马站长:http://zhanzhang.sm.cn/

列表页适配

url匹配规则,中间间隔换为tab键,保存为txt文件放置到网站任意目录。同360搜索引擎

内容页移动适配

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <urlset>
  3. <url>
  4.     <loc>https://www.dadongjie.com</loc> #网站首页
  5.     <data>
  6.         <display>
  7.             <pc_url_pattern>
  8.                 https://www.dadongjie.com/(\w+)/(\d+).html
  9.             </pc_url_pattern>  #PC端网页
  10.             <xhtml_url_pattern >
  11.                 https://m.dadongjie.com/view.php?aid=${2}
  12.             </xhtml_url_pattern> #html5手机页
  13.         </display>
  14.     </data>
  15. </url>
  16. #第二组开始
  17. <url>
  18.     <loc>https://www.dadongjie.com</loc>
  19.     <data>
  20.         <display>
  21.             <pc_url_pattern>
  22.                 https://www.dadongjie.com/(\w+)/(\w+)/(\d+).html
  23.             </pc_url_pattern>
  24.             <xhtml_url_pattern >
  25.                 https://m.dadongjie.com/view.php?aid=${2}
  26.             </xhtml_url_pattern>
  27.         </display>
  28.     </data>
  29. </url>
  30. #第二组结束,以<url>开头</url>结束    
  31. </urlset>

至此各大搜索引擎的移动适配规则告一段落,可能会有所偏差,但上述的内容应该通用于大部分的dede网站的移动适配。

 

李金龙

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:2   其中:访客  1   博主  1

    • avatar 烈火 0

      现在不用那么麻烦,我用的跨屏网针对dedecms提供的免费的方案,在网站添加一句js,快速适配手机