欢迎光临
我们一直在努力

如何在UEditor中A链接自动添加rel="nofollow"属性

在网站的SEO优化过程中,rel=”nofollow”属性的使用变得越来越普遍。然而,百度编辑器UEDITOR并未默认添加这个标签,这会使得在引入其他站点URL链接时,流失蜘蛛并导致网站权重下降。因此,在本篇文章中,我们将教您如何将ueditor的link自动添加rel=”nofollow”属性。

首先,您需要找到/core/extend/ueditor/dialogs/link/link.html文件,并修改第81行的代码。原始代码如下:

'href': href,
'target': $G("target").checked ? "_blank" : '_self',
'title': $G("title").value.replace(/^\s+|\s+$/g, ''),
'_href': href

您需要将其修改为以下代码:

'href': href,
'target': $G("target").checked ? "_blank" : '_self',
'title': $G("title").value.replace(/^\s+|\s+$/g, ''),
'rel': 'nofollow',
'_href': href

这里我们添加了’rel’: ‘nofollow’,这样就可以自动添加rel=”nofollow”属性了。

接下来,您需要找到/core/extend/ueditor/ueditor.config.js文件,并修改第370行的代码。原始代码如下:

a: ['target', 'href', 'title', 'class', 'style','name','id'],
abbr: ['title', 'class', 'style'],
abbr: ['title', 'class', 'style'],
area: ['shape', 'coords', 'href', 'alt'],

您需要将其修改为以下代码:

a: ['target', 'href', 'title', 'class', 'style','name','rel','id'],
abbr: ['title', 'class', 'style'],
abbr: ['title', 'class', 'style'],
area: ['shape', 'coords', 'href', 'alt'],

这里我们添加了’rel’属性,这样就可以自动添加rel=”nofollow”属性了。

完成以上两个步骤后,您就可以实现ueditor的link自动添加rel=”nofollow”属性了。在网站后台测试添加链接时,您也可以确认是否已成功添加。

赞(0) 打赏
未经允许不得转载:新起点博客 » 如何在UEditor中A链接自动添加rel="nofollow"属性


关注公众号『新起点软件管家』

获取最新网络资源及破解软件!
带你玩转各样软件...

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏