由于百度的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'],
简单的说就是修改两个文件。
作者:沃航科技