13397158231   jevian_ma@worldflying.cn

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'],

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

作者:沃航科技

优秀产品推荐:可编程网络IO控制器

上一篇:开发高质量软件需要什么

下一篇:http digest认证

联系我们

  • 地址:武汉市东湖高新开发区光谷总部国际1栋2412室
  • QQ:932773931
  • 电话:027-59761089-806
  • 手机:13397158231
  • 邮箱:jevian_ma@worldflying.cn

关注公众号

扫码添加微信

沃航(武汉)科技有限公司版权所有

备案号:鄂ICP备16014230号-1

本网站由提供CDN加速/云存储服务