您好,欢迎访问沃航(武汉)科技有限公司官方网站
ueditor给超链接默认添加rel="nofollow"标签
2019-06-01 01:07:26

由于百度的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'],

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

作者:沃航科技

联系我们
地址:
武汉市洪山区蓝晶国际7栋903
QQ:
932773931
电话:
027-59761089-806
手机:
13397158231
邮箱:
jevian_ma@worldflying.cn
×
物联网组态平台
试用账号:123456
试用密码:123456
如需测试更多功能或者有疑问可发送邮件至:jevian_ma@worldflying.cn
×
积木编程平台
试用方式:试用手机号码注册即可使用
如需测试更多功能或者有疑问可发送邮件至:jevian_ma@worldflying.cn