为了在PbootCMS中使用百度编辑器UEditor时,让所有插入的超链接默认添加 rel="nofollow"
标签,您需要修改两个文件:link.html
和 ueditor.config.js
。以下是详细的步骤和说明:
步骤1:修改 link.html
-
找到文件:
- 文件路径:
/core/extend/ueditor/dialogs/link/link.html
- 文件路径:
-
编辑文件:
-
打开
link.html
文件。 -
找到第81行左右的代码段,通常如下所示:
javascript'href' : href,
'target' : $G("target").checked ? "_blank" : '_self',
'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
'_href':href
-
-
修改代码:
-
将上述代码段修改为:
javascript'href' : href,
'target' : $G("target").checked ? "_blank" : '_self',
'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
'rel': 'nofollow',
'_href':href
-
步骤2:修改 ueditor.config.js
-
找到文件:
- 文件路径:
/core/extend/ueditor/ueditor.config.js
- 文件路径:
-
编辑文件:
-
打开
ueditor.config.js
文件。 -
找到第370行左右的代码段,通常如下所示:
javascripta: ['target', 'href', 'title', 'class', 'style','name','id'],
abbr: ['title', 'class', 'style'],
area: ['shape', 'coords', 'href', 'alt'],
-
-
修改代码:
-
将上述代码段修改为:
javascripta: ['target', 'href', 'title', 'class', 'style','name','rel','id'],
abbr: ['title', 'class', 'style'],
area: ['shape', 'coords', 'href', 'alt'],
-