织梦导航外部链接新窗口打开加上nofollow属性

织梦导航外部链接新窗口打开加上nofollow属性,第1张

概述SEO优化中,对织梦主导航的设计非常讲究,主导航链接是栏目链接,一般直接跳转;如果主导航链接是外部链接,不可直接跳出,会增加网站的跳出率。此类链接应设置在新窗口打开target=_blank,并且用nofollow不让蜘蛛抓取该链接。下面是修改方法。 打开/include

 SEO优化中,对织梦主导航的设计非常讲究,主导航链接是栏目链接,一般直接跳转;如果主导航链接是外部链接,不可直接跳出,会增加网站的跳出率。此类链接应设置在新窗口打开target="_blank",并且用nofollow不让蜘蛛抓取该链接。下面是修改方法。

  打开/include/taglib/channel.lib.PHP,找到

 

 if($needRel)  {  $row['sonIDs'] = GetSonIDs($row['ID'],false);  if($row['sonIDs']=='') $row['rel'] = '';  else $row['rel'] = "ID']}'";  }

  

下面增加

  $row['target'] = ($row['ispart']==2) ? "target = '_blank'" : "target = '_self'"; //新窗口打开

  $row['nofollow'] = ($row['ispart']==2) ? "rel = 'nofollow'" : "rel = 'follow'"; //nofollow属性

  需要currentstyle支持这两个属性,继续往下找到

  $linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);

  

下面增加

  $linkOkstr = str_replace("~target~",$row['target'],$linkOkstr);  $linkOkstr = str_replace("~nofollow~",$row['nofollow'],$linkOkstr);  在导航标签里面增加新标签[fIEld:target/]、[fIEld:nofollow/]即可,这两个标签根据实际情况使用。  {dede:channel type='self' currentadsbygoogle"          data-ad-layout="in-article"     data-ad-format="fluid"     data-ad-client="ca-pub-4605373693034661"     data-ad-slot="1300602012">          总结       

以上是内存溢出为你收集整理的织梦导航外部链接新窗口打开加上nofollow属性全部内容,希望文章能够帮你解决织梦导航外部链接新窗口打开加上nofollow属性所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/zz/1053907.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)