

Ueditor编辑器为超链接增加nofollow功能
source link: https://www.lanka.cn/Ueditor-nofollow_4478.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

前言
经常在发布文章的时候会加入第三方网站的URL链接,超链接最主要还是方便用户直接跳转,但是外链在一定程度上会流失一些权重,所以就考虑为内容里面的超链接增加「nofollow」功能。

修改过程
文件路径:ueditor/dialogs/link 目录
文件名:link.html
1、在链接弹出窗口增加「nofollow」选项
<tr> <td colspan="2"> <label for="target"> <var id="lang_input_target"></var> </label> input id="target" type="checkbox"/> </td> </tr>
<tr> <td colspan="2"> <label for="rel">是否加nofollow</label> <input id="rel" type="checkbox"/> </td> </tr>
2、代码增加「nofollow」功能
function handleDialogOk()
在此函数里增加如下代码
'rel': $G("rel").checked ? "nofollow" : '',
OK 我们继续操作
3、JS文件修改
文件目录:ueditor
文件名:ueditor.config.js
“// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js”
a: ['target', 'href', 'title', 'class', 'style','rel'],
结尾
通过以上修改,可以通过自行控制是否添加nofollow功能,不用再手动修改了。

匿名
匿名
匿名
chao.fun
匿名
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK