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 :-)


Related Posts

MothersClick Acquired by Lifetime Networks [] and the rest of the ParentsClick Network []have been acquired by Lifetime Entertainment [] . I’ve been working on this site and with Dietrich (CEO & founder) for over 2

news — 5 min read

Leo talks about the new site

At the end of last week’s TWiT episode [], Leo and company talk about the new site []. A clip of that can be listened to below. Also last week on the Lullabot podcast []

code — 1 min read

My first 15 min of fame!

A few weeks back, Leo Laporte [] approached Lullabot [] about developing the new TWiT website []. Well we gladly accepted, I mean, this is Leo! So I was put in charge of developing the new site, and

code — 1 min read