为了让 PbootCMS 的 UEditor 编辑器给超链接默认添加 rel="nofollow" 标签,你需要按照以下步骤进行修改。

步骤 1: 修改 link.html 文件

  1. 定位文件

    • 找到 core/extend/ueditor/dialogs/link/link.html 文件。
  2. 修改第 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 文件

  1. 定位文件

    • 找到 core/extend/ueditor/ueditor.config.js 文件。
  2. 修改第 370 行

    • 将原有的代码:
      javascript
       
      a: ['target', 'href', 'title', 'class', 'style','name','id'],
      abbr: ['title', 'class', 'style'],
      abbr: ['title', 'class', 'style'],
      area: ['shape', 'coords', 'href', 'alt'],
    • 修改为:
      javascript
       
      a: ['target', 'href', 'title', 'class', 'style','name','rel','id'],
      abbr: ['title', 'class', 'style'],
      abbr: ['title', 'class', 'style'],
      area: ['shape', 'coords', 'href', 'alt'],