Skip to content

New external links filter for Drupal

1 min read

Update: version 2 has been released that fixes some bugs and adds new features.

More than a year ago, I released an outgoing links filter (OLF)for Drupal. This module worked well and added a CSS class to outgoing links.

However, I didn’t touch the module for more than a year (it only worked in Drupal 4.7!) and it kind of faded away… until, today!

In keeping current with more widely used lingo, I decided to create an external links filter (ELF) that worked in Drupal 5, had nifty icons, and was all around more robust.

So why is this better than other modules that do this?

Well there are a couple reasons. Other modules, like External links rely on Javascript to find external links. This is not the best choice because:

  • It will find all external links on a page, what about ones that appear in main menus, images, and more? Might produce some odd results.
  • The page has to be loaded and the DOM parseable before it can find links. Therefore, a user could notice a delay on a page with tons of links, and worse, the page could look jittery as CSS is applied as links are found in realtime.
  • Depending on how the site is loaded (Google cache, iframe) you could end up with weird results since the Javascript doesn’t know the correct URL anymore.
  • Parsing can’t be cached.

While there are many valid reasons to use this module (it is still written very well), it is in my opinion that a more optimal approach would be to rely on Drupal’s filtering system.

This way you can find external links on only the content you want (e.g., switch filters, configure them differently) and the page loads with the CSS class already applied to all links, so that your CSS and JS can take affect right away, with no lag, and doesn’t eat up a user’s browser resources parsing links.

And with that, I announce the new elf module for Drupal. If anything, it should get bonus points for the name :-)

codeDrupal

Related Posts

Members Public

The Future of Automotive Mobility will be Powered by Open Source Software

Automotive companies are shifting from bending metal to bending bits. Soon they will be offering software and services to complement their manufactured metal. In order to win in the market, they will need to embrace open-source software to build leverage and enhance their offering.

Members Public

How to Host Your Static Website on Amazon S3: Step-by-Step Guide

1. Login to your Amazon AWS account 2. Create a new hosted zone for your domain using Route 53 3. Copy the NS records for this zone to your domain provider (e.g., GoDaddy) 4. Edit your domain on your domain registrar (e.g., GoDaddy) by clicking Set Nameservers 5.

Members Public

Book Review: Drupal 7 Module Development

Well, it’s been a while my Drupal friends, almost 18 months… dusting off this old Drupal 6 blog and time to start posting again. And what better way to get started again than by talking about Drupal 7, by far the best release of Drupal. And with almost 7