织梦给栏目增加链接属性rel、nofollow和新窗口target

资源来源网络,如需授权,请更换源码,模块仅供学习,如需商用请购买正版授权,本栏目不提供技术服务,积分不够请签到!如何签到?系统升级暂停签到,恢复关注公告!
如遇下载链接蓝奏网盘打不开lanzous替换成lanzoux尝试! 广告

 

大家应该都知道rel=’nofllow’的作用,它是告诉搜索引擎,不要将该链接计入权重。

因此多数情况下,我们可以将一些不想传递权重的链接进行nofllow处理;

例如一些非本站的链接,不想传递权重,但是又需要加在页面中的,

像 外部链接、统计代码、备案号链接、供用户查询的链接等等。

为了方便管理,直接在织梦后台栏目里自由把控每个栏目对应的链接属性,

我们来给织梦栏目增加链接属性rel=”nofllow” rel=”external” rel=”external nofollow”和新窗口target=”_blank”

rel=”nofllow” (告诉搜索引擎该链接不计入权重)
rel=”external” (告诉搜索引擎该链接不是本站链接)
rel=”external nofollow” (告诉搜索引擎该链接不是本站链接也不计入权重)


实现教程

1、后台-系统-SQL工具,执行

ALTER TABLE `#@__arctype` ADD `nofollow` CHAR( 60 ) NOT NULL DEFAULT ”;
ALTER TABLE `#@__arctype` ADD `target` CHAR( 60 ) NOT NULL DEFAULT ”;

2、打开 /dede/catalog_add.php 找到,大概在 239 行左右

UpDateCatCache();

在它的 上面 加入

$id = $dsql->GetLastID();
$upquery = “UPDATE `#@__arctype` SET `nofollow`=’$nofollow’,`target`=’$target’ WHERE id=’$id’ “;
$dsql->ExecuteNoneQuery($upquery);

3、打开 /dede/catalog_edit.php 找到,大概在 106 行左右

UpDateCatCache();

在它的 上面 加入

$upquery = “UPDATE `#@__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>

如图

%title插图%num

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

改成

栏目调用标签里的标签写法

dede:channelartlist标签写法

<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标签写法

{dede:channel type=top row=7}
<li><a href=”[field:typelink/]” [field:nofollow/] [field:target/]>[field:typename/]</a></li>
{/dede:channel}

dede:type标签写法

{dede:type typeid=1}
<li><a href=”[field:typeurl/]” [field:nofollow/] [field:target/]>[field:typename/]</a></li>
{/dede:type}

注意:标红的那2个标签前面记得要加个空格

©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!
风格酷模板网 » 织梦给栏目增加链接属性rel、nofollow和新窗口target
NOTICE:【咨询风格酷】客服QQ:1131734965
NOTICE:【咨询风格酷】客服微信:wwwxmamnet
NOTICE:【风格酷模板网②群】QQ群:288678775
☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。
☉如果源码网盘地址失效!或有其他问题,请点我报错,谢谢合作!
☉人民币与积分汇率为1比10,即1元=10积分.有任何疑问请联系客服
☉如有其他问题,请加网站客服QQ(1131734965)进行交流。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
☉源码、模板等资源会随着技术、环境的升级而存在部分问题,还请慎重选择。

发表评论

风格酷模板网www.xmam.net分享优质网站模板

立即查看 了解详情