html 链接nofollow,ueditor给超链接默认添加rel="nofollow"标签

由于百度的seo规则,越来越多的站长开始重视rel="nofollow"功能了。并且由于ueditor的强大功能与免费的特性,渐渐也成为了众多屌丝站长的首选网站编辑器。

但是由于ueditor本身并不自带rel="nofollow"功能,因此默认情况下,如果要引入其他站点的链接,就会导致自己的网站权重下降。如果能修改代码,让ueditor的link自带rel="nofollow"就好了。现在我就来教大家怎么改。

话不多说,直接上补丁。diff --git a/ueditor/dialogs/link/link.html b/ueditor/dialogs/link/link.html

index 55ab4d1..cce7ec8 100644

--- a/ueditor/dialogs/link/link.html

+++ b/ueditor/dialogs/link/link.html

@@ -79,6 +79,7 @@

'href' : href,

'target' : $G("target").checked ? "_blank" : '_self',

'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),

+                'rel': 'nofollow',

'_href':href

};

//修改链接内容的情况太特殊了,所以先做到这里了

diff --git a/ueditor/ueditor.config.js b/ueditor/ueditor.config.js

index acacc9d..e1dce7e 100644

--- a/ueditor/ueditor.config.js

+++ b/ueditor/ueditor.config.js

@@ -363,7 +363,7 @@

,outputXssFilter: true

// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js

,whitList: {

-                       a:      ['target', 'href', 'title', 'class', 'style'],

+                       a:      ['target', 'href', 'title', 'class', 'style', 'rel'],

abbr:   ['title', 'class', 'style'],

address: ['class', 'style'],

area:   ['shape', 'coords', 'href', 'alt'],

简单的说就是修改两个文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值