为了让UEditor在生成超链接时默认添加 rel="nofollow"
属性,可以按照以下步骤进行修改。这样可以防止搜索引擎蜘蛛流失,保护网站的权重。
修改步骤
-
修改
link.html
文件- 找到
core/extend/ueditor/dialogs/link/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 - 找到
-
修改
ueditor.config.js
文件- 找到
core/extend/ueditor/ueditor.config.js
文件。 - 修改第 370 行。
将以下代码:
javascripta: ['target', 'href', 'title', 'class', 'style','name','id'],
abbr: ['title', 'class', 'style'],
address: ['class', 'style'],
area: ['shape', 'coords', 'href', 'alt'],修改为:
javascripta: ['target', 'href', 'title', 'class', 'style','name','rel','id'],
abbr: ['title', 'class', 'style'],
address: ['class', 'style'],
area: ['shape', 'coords', 'href', 'alt'], - 找到