SEO優(yōu)化中,對(duì)主導(dǎo)航的設(shè)計(jì)非常講究,主導(dǎo)航鏈接是欄目鏈接,一般直接跳轉(zhuǎn);如果主導(dǎo)航鏈接是外部鏈接,不可直接跳出,會(huì)增加網(wǎng)站的跳出率。此類鏈接應(yīng)設(shè)置在新窗口打開(kāi)target="_blank",并且用nofollow不讓蜘蛛抓取該鏈接。下面是修改方法。
打開(kāi)/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'"; //新窗口打開(kāi),橙色部分可不要 $row['nofollow'] = ($row['ispart']==2) ? "rel = 'nofollow'" : "rel = 'follow'"; //nofollow屬性,橙色部分可不要
需要currentstyle支持這兩個(gè)屬性,繼續(xù)往下找到
$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
下面增加
$linkOkstr = str_replace("~target~",$row['target'],$linkOkstr); $linkOkstr = str_replace("~nofollow~",$row['nofollow'],$linkOkstr);
在導(dǎo)航標(biāo)簽里面增加新標(biāo)簽[field:target/]、[field:nofollow/]即可,這兩個(gè)標(biāo)簽根據(jù)實(shí)際情況使用。
{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}