小鹿学院 > SEM营销 > 资讯正文
织梦的移动化适配
2018-01-27 21:38 小鹿推广

小鹿系列竞价软件覆盖百度、360、搜狗、神马四大搜索平台,采用独创的竞价算法,智能精准出价,一键批量查排名,根据关键词位置实时调整出价,降低出价虚高,稳定排名,节省企业预算。

小鹿竞价软件专题介绍:https://www.xiaolutg.com/bidding/fengchao?ref=menu

  <meta http-equiv=http://seo.baidutop123.com/seoyh/"mobile-agent"content=http://seo.baidutop123.com/seoyh/"format=xhtml;url={dede:global.cfg_mobileurl/}/">

  <scripttype=http://seo.baidutop123.com/seoyh/"text/javascript">

  if(window.location.toString().indexOf("pref=padindex")!= -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href=http://seo.baidutop123.com/seoyh/"{dede:global.cfg_mobileurl/}/";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}

  </script>

  2、栏目页

  <metahttp-equiv=http://seo.baidutop123.com/seoyh/"mobile-agent"content=http://seo.baidutop123.com/seoyh/"format=xhtml;url={dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}">

  <scripttype=http://seo.baidutop123.com/seoyh/"text/javascript">

  if(window.location.toString().indexOf("pref=padindex")!= -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) ||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href=http://seo.baidutop123.com/seoyh/"{dede:global.cfg_mobileurl/}/list.php?tid={dede:field.id/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}

  </script>

  3、文章页

  <meta http-equiv=http://seo.baidutop123.com/seoyh/"mobile-agent"content=http://seo.baidutop123.com/seoyh/"format=xhtml;url={dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}">

  <script type=http://seo.baidutop123.com/seoyh/"text/javascript">

  if(window.location.toString().indexOf("pref=padindex") !=-1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) ||(/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|WindowsPhone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href=http://seo.baidutop123.com/seoyh/"{dede:global.cfg_mobileurl/}/view.php?aid={dede:field.id/}";}elseif(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}

  </script>

  代码中的{dede:global.cfg_mobileurl/}部分要替换为包含“”的二级域名(即:),如不想修改模板里的相关代码,也可修改/include/common.inc.php中的$cfg_mobileurl变量赋值为二级域名。

  以上代码为dedecms新版模板所使用,第一行<meta>标签代码为百度发现跳转适配关系的方式(可同时使用)之一――“Meta标记”,下面几行javascript代码的功能是识别是否移动端设备访问,如是则将当前pc端页面自动跳转到匹配的移动端页面。

  二、还可使用<link>标签以便于百度更好地发现PC站和移动站的移动适配关系,在模板的<head></head>标签内加入如下代码:

  1、PC站首页模板:

  <link rel=http://seo.baidutop123.com/seoyh/"alternate" media=http://seo.baidutop123.com/seoyh/"only screen and(max-width: 640px)" href=http://seo.baidutop123.com/seoyh/"" >

  2、PC站栏目页模板:

  <link rel=http://seo.baidutop123.com/seoyh/"alternate" media=http://seo.baidutop123.com/seoyh/"only screen and(max-width: 640px)"href=http://seo.baidutop123.com/seoyh/"?tid={dede:field.id/}" >

  3、PC站文章页模板:

  <link rel=http://seo.baidutop123.com/seoyh/"alternate" media=http://seo.baidutop123.com/seoyh/"only screen and(max-width: 640px)" href=http://seo.baidutop123.com/seoyh/" ?aid={dede:field.id/}">

  4、移动站首页模板:

  <link rel=http://seo.baidutop123.com/seoyh/"canonical"href=http://seo.baidutop123.com/seoyh/" "/>

  5、栏目页模板:

  <link rel=http://seo.baidutop123.com/seoyh/"canonical"href=http://seo.baidutop123.com/seoyh/"{dede:type typeid="0" row=1}[field:typelink/]{/dede:type}"/>

  6、文章页模板:

  <link rel=http://seo.baidutop123.com/seoyh/"canonical"href=http://seo.baidutop123.com/seoyh/"{dede:field.idrunphp="yes"[emailprotected];@me="";$url=GetOneArchive($id);@me=$url["arcurl"];{/dede:field.id}"/>

  三、提交移动跳转适配

  1、URL对应关系示例:

  

  2、适配方式:

  栏目页的对应关系没有规律,且数量较少,使用URL适配 ;文章页为有规律的网址,且数量多,使用规则适配。

  提交文章页规则适配(如图):

  

  提交首页和栏目页URL适配(如图):

  

  对于栏目较多的Dedecms网站,人工列出所有的栏目页URL对显然很费事,这里推荐一个方法可以轻松解决该问题:

  ※在模板中嵌入以下代码,对应前台页面中即可显示所有栏目的URL对,复制粘贴即可:

  {dede:channelartlist row=100 typeid="top"}

  {dede:field name="typeurl"/}?tid={dede:field name="id"/}<br>

  {dede:channel type="son" noself="true"}

  [field:typelink/]?tid=[field:id/]<br>

  {/dede:channel}

  {/dede:channelartlist}

  ※提交完规则适配,等待百度审核。

  如果所提交的适配关系有误,处理状态将很快会出现“校验失败”的提示。

卧龙

百度

点睛

搜狗

标签: 小鹿SEM推广
<< 上一篇

织梦(dedecms)主动推送插件分享

下一篇 >>

做SEO前分析关键词排名数据

相关资讯

关注公众号 获取更多干货资讯

400-998-8026