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} |



















