Discuz!x3.2 导航添加nofollow 属性解决方案之一
方案说明:某些应用环境下,可能需要将导航部分的连接全部加上nofollow适用版本:Discuz!x3.2
解决方法:
1.打开\source\function\cache\cache_setting.php
搜索:$item = "<a href=\"$subnav\" hidefocus=\"true\" ".($subnav['title'] ? "title=\"$subnav\" " : '').($subnav['target'] == 1 ? "target=\"_blank\" " : '').parsehighlight($subnav['highlight']).">$subnav</a>";
修改为
$item = "<a href=\"$subnav\" rel=\"nofollow\" hidefocus=\"true\" ".($subnav['title'] ? "title=\"$subnav\" " : '').($subnav['target'] == 1 ? "target=\"_blank\" " : '').parsehighlight($subnav['highlight']).">$subnav</a>";
搜索:
$data['navs'][$id]['nav'] = "id=\"$navid\" ".($onmouseover ? 'onmouseover="'.$onmouseover.'"' : '')."><a href=\"$nav\" hidefocus=\"true\" ".($nav['title'] ? "title=\"$nav\" " : '').($nav['target'] == 1 ? "target=\"_blank\" " : '')." $nav>$nav".($nav['identifier'] == 5 && $nav['type'] == 0 ? '<b class="icon_down"></b>' : '')."</a";
修改为
$data['navs'][$id]['nav'] = "id=\"$navid\" ".($onmouseover ? 'onmouseover="'.$onmouseover.'"' : '')."><a href=\"$nav\" rel=\"nofollow\" hidefocus=\"true\" ".($nav['title'] ? "title=\"$nav\" " : '').($nav['target'] == 1 ? "target=\"_blank\" " : '')." $nav>$nav".($nav['identifier'] == 5 && $nav['type'] == 0 ? '<b class="icon_down"></b>' : '')."</a";
2.覆盖同名文件,更新缓存
页:
[1]