大家應(yīng)該都知道rel='nofllow'的作用,它是告訴搜索引擎,不要將該鏈接計入權(quán)重。
 
因此多數(shù)情況下,我們可以將一些不想傳遞權(quán)重的鏈接進(jìn)行nofllow處理;
 
例如一些非本站的鏈接,不想傳遞權(quán)重,但是又需要加在頁面中的,
 
像 外部鏈接、統(tǒng)計代碼、備案號鏈接、供用戶查詢的鏈接等等。
 
為了方便管理,直接在織夢后臺欄目里自由把控每個欄目對應(yīng)的鏈接屬性,
 
我們來給織夢欄目增加鏈接屬性rel="nofllow" rel="external" rel="external nofollow"和新窗口target="_blank"
 
rel="nofllow" (告訴搜索引擎該鏈接不計入權(quán)重)
rel="external" (告訴搜索引擎該鏈接不是本站鏈接)
rel="external nofollow" (告訴搜索引擎該鏈接不是本站鏈接也不計入權(quán)重)
 
 
實現(xiàn)教程
1、后臺-系統(tǒng)-SQL工具,執(zhí)行
 
ALTER TABLE `dede_arctype` ADD `nofollow` CHAR( 60 ) NOT NULL DEFAULT '';
ALTER TABLE `dede_arctype` ADD `target` CHAR( 60 ) NOT NULL DEFAULT '';
 
2、打開 /dede/catalog_add.php 找到,大概在 239 行左右
 
UpDateCatCache();
 
在它的 上面 加入
 
$id = $dsql->GetLastID();
$upquery = "UPDATE `dede_arctype` SET `nofollow`='$nofollow',`target`='$target' WHERE id='$id' ";
$dsql->ExecuteNoneQuery($upquery);
 
3、打開 /dede/catalog_edit.php 找到,大概在 106 行左右
 
UpDateCatCache();
 
在它的 上面 加入
 
$upquery = "UPDATE `dede_arctype` SET `nofollow`='$nofollow',`target`='$target' WHERE id='$id' ";
$dsql->ExecuteNoneQuery($upquery);
 
4、打開 /dede/templets/catalog_add.htm 找到
 
欄目屬性
 
在它上面一行的<tr>上面加入
 
<tr> 
<td width="150" class='bline' height="26" style="padding-left:10px;">鏈接屬性rel:</td>
<td class='bline'>
<select name="nofollow" id="nofollow" style="width:140px;">
<option value=''>請選擇屬性</option>
<option value='rel="external"'>external</option>
<option value='rel="nofollow"'>nofollow</option>
<option value='rel="external nofollow"'>external nofollow</option>
</select>
<input style="vertical-align:middle; margin-top:-2px; margin-bottom:1px;" type="checkbox" name="target" value='target="_blank"' class="np">
新窗口打開
</td>
</tr>
 
如圖
 
5、打開 /dede/templets/catalog_edit.htm 找到
 
欄目屬性
 
在它上面一行的<tr>上面加入
 
<tr> 
<td width="150" class='bline' height="26" style="padding-left:10px;">鏈接屬性rel:</td>
<td class='bline'>
<select name="nofollow" id="nofollow" style="width:140px;">
<option value=''<?php if($myrow['nofollow']=='') echo " selected";?>>請選擇屬性</option>
<option value='rel="external"'<?php if($myrow['nofollow']=='rel="external"') echo " selected";?>>external</option>
<option value='rel="nofollow"'<?php if($myrow['nofollow']=='rel="nofollow"') echo " selected";?>>nofollow</option>
<option value='rel="external nofollow"'<?php if($myrow['nofollow']=='rel="external nofollow"') echo " selected";?>>external nofollow</option>
</select>
<input style="vertical-align:middle; margin-top:-2px; margin-bottom:1px;" type="checkbox" name="target" value='target="_blank"' class="np"<?php if($myrow['target']=='target="_blank"') echo " checked='1' ";?>>
新窗口打開
</td>
</tr>
 
如圖
 
6、打開 /include/taglib/channel.lib.php 找到,80、86、92、111行的
 
id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
 
這4處都改成
 
*
 
如圖
 
7、打開 /include/taglib/channelartlist.lib.php 找到,大概在 78 行
 
id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
 
改成
 
*
 
如圖
 
8、打開 /include/taglib/type.lib.php 找到,大概在 42 行
 
id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
 
改成
 
*
 
如圖
 
欄目調(diào)用標(biāo)簽里的標(biāo)簽寫法
dede:channelartlist標(biāo)簽寫法
 
<ul>
    {dede:channelartlist row=7 typeid=top}
    <li><a href="{dede:field.typeurl/}" {dede:field.nofollow/} {dede:field.target/}>{dede:field.typename/}</a></li>
    {/dede:channelartlist}
</ul>
 
dede:channel標(biāo)簽寫法
 
{dede:channel type=top row=7}
<li><a href="[field:typelink/]" [field:nofollow/] [field:target/]>[field:typename/]</a></li>
{/dede:channel}
 
dede:type標(biāo)簽寫法
 
{dede:type typeid=1}
<li><a href="[field:typeurl/]" [field:nofollow/] [field:target/]>[field:typename/]</a></li>
{/dede:type}
 
注意:標(biāo)紅的那2個標(biāo)簽前面記得要加個空格