1) Checking the config option "Open external links in a new window" now also adds the 'nofollow' rel attribute to all external links, which is not documented anywhere and presents a considerable SEO impact which should be contained in a different option, not in this one.

2) The JS code for said config option has several critical issues:

2.1)

Duplicate if check.

    if (drupalSettings.data.extlink.extTarget) {
      // Apply the target attribute to all links.
      if (drupalSettings.data.extlink.extTarget) {

2.2)

rel attribute is forced to "nofollow", overriding potentially existing other values.

After that, the rel attribute is checked for emptiness, which is impossible after the preceding "nofollow" set.

Finally, the code attempts to add the value "nofererer" to the rel attribute on several occasions, rather than "noreferrer". A typo.

        $(external_links).attr({target:'_blank', rel:'nofollow'});
        $(external_links).attr('rel', function (i, val) {
          // If no rel attribute is present, create one with the values noopener and noreferrer.
          if (val === null) {
            return 'noopener nofererer';
          }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ivi.arocom created an issue. See original summary.

yoruvo’s picture

Issue summary: View changes
elachlan’s picture

Priority: Critical » Normal
Related issues: +#2751743: Hide external links from bots: rel nofollow, etc

You are correct, this was done with SEO in mind. I have attached the related issue.

Please submit a patch and I will see about its inclusion.

yoruvo’s picture

Attached patch created in PhpStorm with the following changes:

  • Separated "nofollow" rel option into a new checkbox in the settings form.
  • Fixed the proper application of "noopened" and "noreferrer" rel attributes when the target is set to "blank".
  • Fixed logic issues and cleaned up JS code.
yoruvo’s picture

Status: Active » Needs review
yoruvo’s picture

I somehow fumbled the node ID in the filename; reuploading.

The last submitted patch, 4: extlink-rel-cleanup-2751743-4.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 6: extlink-rel-cleanup-2842020-6.patch, failed testing.

yoruvo’s picture

Rerolling against current dev branch, hopefully it tests this time.

elachlan’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: extlink-rel-cleanup-2842020-9.patch, failed testing.

kekkis’s picture

Adding another patch, created with diff. Exactly the same as #9 otherwise.

  • elachlan committed 9e40365 on 8.x-1.x authored by kekkis
    Issue #2842020 by ivi.arocom, kekkis: Very problematic JS in "Open...
elachlan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.