Allow exclusions to 'noreferrer' attribute via pattern matching

Created on 1 October 2020, almost 5 years ago
Updated 29 July 2024, 12 months ago

Problem/Motivation

Sometimes, business and analytics goals requires links to be opened in a new tab, with or without the "noreferrer" attribute applied, depending on a variety of criteria.

Consider two scenarios:

  1. First, suppose you are linking to a different domain, outside of your organization. A business requirement is that the "noreferrer" attribute is applied and the link opens in a new window. This criteria can be accomplished using the options in this module, namely turning on the "Open external links in a new window or tab." and "Tag external links as "noreferrer".
  2. Now, suppose you are linking to a different domain that is still within your organization. For in-organization links, it is still desired that the link is still opened in a new tab, but that the "noreferrer" attribute is not applied. The external link can be detected with this module, and it will open the link in a new tab. However, the "noreferrer" attribute is not customizable beyond that.

Steps to reproduce

To test:

  1. Go to this module's configuration page at /admin/config/user-interface/extlink
  2. Check the "Tag external links as "noreferrer"
  3. Enter a pattern in the new "Exclude links matching the pattern from having 'noreferrer' applied." field
  4. Create a page with some external links, both those matching and not matching your pattern.
  5. Observe the attribute is added selectively.

Proposed resolution

  • Add a section in the Pattern Matching dropdown that allows for a pattern for when to exclude the "noreferrer" attribute from being added

Remaining tasks

User interface changes

  • Adds a text input in the Pattern Matching dropdown that allows for a pattern for when to exclude the "noreferrer" attribute from being added

API changes

Data model changes

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States patrickfweston Columbus, Ohio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024