洞悉互聯(lián)網(wǎng)前沿資訊,探尋網(wǎng)站營(yíng)銷規(guī)律
作者:狐靈科技 | 2019-12-24 13:59 |點(diǎn)擊:
網(wǎng)站建設(shè)中對(duì)不想?yún)⑴c排名的欄目增加rel=nofollow屬性,而DedeCMS并沒這樣的設(shè)置,在以前版本有[field:rel/]標(biāo)簽,等同于dropmenu加上欄目id,并沒有實(shí)際作用。實(shí)現(xiàn)在{dede:channel}標(biāo)簽下為某個(gè)欄目增加rel=nofollow屬性,跟著重慶SEO吖七修改源文件吧。
Navicat EditPlus
數(shù)據(jù)庫dede_arttype表 /dede/catalog_add.htm /dede/catalog_add.htm /dede/catalog_edit.php /dede/catalog_edit.html
1.在dede_arttype數(shù)據(jù)庫表增加isnofollow字段
用Navicat或其他數(shù)據(jù)庫管理軟件打開dede_arttype表,增加鍵名:isnofollow;類型:smalllint,長(zhǎng)度:6;小數(shù)點(diǎn):0;不允許空值。
2.修改/dede/catalog_add.htm
大概在219行
<tr> <td width="150" class='bline' height="26" style="padding-left:10px;">是否隱藏欄目:</td> <td class='bline'> <input type='radio' name='ishidden' value='0' class='np' checked="checked" /> 顯示 <input type='radio' name='ishidden' value='1' class='np' /> 隱藏 </td> </tr>
下面增加
<tr> <td class="bline" style="padding-left:10px;" width="150" height="26">Nofollow設(shè)置:</td> <td class="bline"> <input name="isnofollow" value="1" class="np" type="radio" /> 是 <input name="isnofollow" value="0" class="np" type="radio" checked='1' /> 否 </td><!--www.vi586.com--> </tr>
3.修改/dede/catalog_add.php
大概在65行的地方,一定要注意符號(hào)
ishidden,
后面增加
isnofollow,
在
'$namerule2','0','0',
后面增加
'0',
另外一處修改,大概在229行
ishidden,
后面增加
isnofollow,
大概在232行
'$ishidden',
后面增加
'$isnofollow',
4.修改/dede/catalog_edit.htm
找到
<tr> <td width="150" class='bline' height="26" style="padding-left:10px;">是否隱藏欄目:</td> <td class='bline'> <input type='radio' name='ishidden' value='0' class='np'<?php if($myrow['ishidden']=="0") echo " checked='1' ";?>/> 顯示 <input type='radio' name='ishidden' value='1' class='np'<?php if($myrow['ishidden']=="1") echo " checked='1' ";?>/> 隱藏 </td> </tr>
下面增加
<tr> <td class="bline" style="padding-left:10px;" width="150" height="26">Nofollow設(shè)置:</td> <td class="bline"> <input name="isnofollow" value="1" class="np" type="radio" <?php if($myrow['isnofollow']=="1") echo " checked='1' ";?>> 是 <input name="isnofollow" value="0" class="np" type="radio" <?php if($myrow['isnofollow']=="0") echo " checked='1' ";?>/> 否 </td> </tr>
5.修改/dede/catalog_edit.php
找到如下代碼:
ishidden='$ishidden',
注意一共有兩處,代碼下面增加
isnofollow='$isnofollow',
這樣就可以在欄目修改里看到效果,默認(rèn)欄目沒有該屬性。
6.前臺(tái)模板調(diào)用
<div class="nav pl">
<ul>
<li><a href="{dede:global.cfg_basehost/}">{dede:global.cfg_indexname/}</a></li>
{dede:channel typeid='' type='top'}<li><a href="[field:typeurl/]"
[field:isnofollow runphp="yes"]
if(@me==1) @me="rel='nofollow'";else @me="";
[/field:isnofollow]>[field:typename/]</a></li>{/dede:channel}
</ul>
</div>
但是這樣寫是調(diào)用不出來的,因?yàn)閧dede:channel}沒有這個(gè)詞,修改方法和增加英文欄目名、欄目縮略圖是一樣的,
打開/include/taglib/channel.lib.php,找到如下代碼,
if($type=='top')
找到
typename
有三處修改,大概在78,86,92行,在typename后面增加下面代碼,注意前面一個(gè)逗號(hào)。
,isnofollow