SEO優(yōu)化中,對(duì)織夢(mèng)主導(dǎo)航的設(shè)計(jì)非常講究,主導(dǎo)航鏈接是欄目鏈接,一般直接跳轉(zhuǎn);如果主導(dǎo)航鏈接是外部鏈接,不可直接跳出,會(huì)增加網(wǎng)站的跳出率。此類鏈接應(yīng)設(shè)置在新窗口打開target="_blank",并且用nofollow不讓蜘蛛抓取該鏈接。下面是修改方法。
打開/include/taglib/channel.lib.php,找到
05 |
$row[ 'sonids' ] = GetSonIds($row[ 'id' ], 0, false ); |
07 |
if ($row[ 'sonids' ]== '' ) $row[ 'rel' ] = '' ; |
09 |
else $row[ 'rel' ] = "id']}'" ; |
|
下面增加
$row['target'] = ($row['ispart']==2) ? "target = '_blank'" : "target = '_self'"; //新窗口打開
$row['nofollow'] = ($row['ispart']==2) ? "rel = 'nofollow'" : "rel = 'follow'"; //nofollow屬性
需要currentstyle支持這兩個(gè)屬性,繼續(xù)往下找到
$linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr);
下面增加
01 |
$linkOkstr = str_replace( "~target~" ,$row[ 'target' ],$linkOkstr); |
03 |
$linkOkstr = str_replace( "~nofollow~" ,$row[ 'nofollow' ],$linkOkstr); |
05 |
在導(dǎo)航標(biāo)簽里面增加新標(biāo)簽[field:target/]、[field:nofollow/]即可,這兩個(gè)標(biāo)簽根據(jù)實(shí)際情況使用。 |
07 |
{dede:channel type = 'self' currentstyle=" |
09 |
<li class= 'thisclass' ><a href= '~typelink~' ~target~ ~nofollow~>~typename~</a></li>"} |
11 |
<li><a href= '[field:typeurl/]' [field:target/] [field:nofollow/]>[field:typename/]</a></li> |
|