• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦导航外部链接新窗口打开加上nofollow属性
    POST TIME:2021-05-23 02:41

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

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

     

     if($needRel)
    
      {
    
      $row['sonids'] = GetSonIds($row['id'], 0, 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' currentstyle="
    
      <li class='thisclass'><a href='~typelink~' ~target~ ~nofollow~>~typename~</a></li>"}
    
      <li><a href='[field:typeurl/]' [field:target/] [field:nofollow/]>[field:typename/]</a></li>
    
      {/dede:channel}

    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!