Extlinker is a module for adding a target="_blank" attribute to the external links in your body content. It requires no special filter and works directly on the content saved to the database.

How It Works

When an entity is saved, Extlinker checks all the URLs in the body against a list of internal domains you configure in the Extlinker settings. If the href value of a link is not in that list of internal domains, Extlinker adds a target attribute to open the link in a new window.

Why?

  • A lot of people like opening external site URLs in new windows.
  • Sometimes, particularly with decoupled sites, you may be dealing with raw data returned from Drupal and a filter won't work because you aren't actually using a render array. You still want external links in your content's body field to open in a new tab without extra scripting.

This module was made to scratch a very particular itch.

Usage

  1. Enable the module.
  2. Configure your internal domains via: /admin/config/content/extlinker
  3. Write content and save the node.

Notes

Extlinker currently doesn't have any way to update existing content. If you've got existing content you'll need to resave it for Extlinker to trigger after it's been enabled.

Thanks

Extlinker is a module inspired by ELF.

Project information

Releases