Method to include certain internal links

danorton - October 15, 2008 - 16:58
Project:External Links
Version:5.x-1.6
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Transfers to external links don't get recorded in sever logs, but it's valuable information to know when a user selects an external link. It's possible to create a URL redirect for this, but extlink treats this as an internal link.

This patch causes extlink to treat any internal link that begins with "/extlink/" as an external link and, as with selected options for external links, the link can be displayed with an external link icon and/or open a new window when selected. When selected, the internal link will show up in the server's activity log.

While it's possible for links that begin with "/extlink/" to remain at the same site, for operation as described above, the link needs to be established as an external URL redirect.

AttachmentSize
extlink_extlink.patch656 bytes

#1

quicksketch - October 16, 2008 - 22:37

I'm not sure I understand how this is helpful. Are you using another module that puts "extlink/" in your anchor tags' hrefs?

#2

danorton - December 3, 2008 - 00:00

I'm using path_redirect to redirect to external sites. e.g.
From: extlink/google
To: http://www.google.com/

The purpose of using the redirect instead of the direct external link is to track when external links are selected.
The purpose of this extlink patch is to decorate the link as it would an external link.

#3

quicksketch - December 3, 2008 - 01:09
Title:Treat internal links from "/extlink/" root as external» Method to include certain internal links
Status:active» needs work

I think we need a more universal solution than a hard-coded path (like RegEx white and black lists or similar). This patch is too site-specific to have a wide-spread use. This is probably related to #171541: Method to exempt links , only this request is a method to include links, as opposed to exclude them.

#4

danorton - December 3, 2008 - 02:00
Assigned to:danorton» Anonymous

Yeah, I would tend to agree. I'm unassigning this from myself, as I'm not sure I can come up with a proper and timely solution.

The discussion at #171541: Method to exempt links doesn't seem to clearly cover all the areas of icon display and new "popup" windows.

I think a good solution would be to add one regex (or PHP code) to the extlink settings for the icon display and another regex for the popup control, instead of the current simple all-or-none setting.

I just hacked a D6 installation for this same issue.

#5

quicksketch - March 14, 2009 - 04:59
Status:needs work» fixed

Since this issue deals more directly with a programmatic solution than #171541: Method to exempt links (which is mostly CSS work-arounds), I'm updating this issue with the solution I've added to External Links.

External Links now provides RegEx "Include" and "Exclude" patterns, with a decent amount of starter help text for people. I'll be releasing a 1.7 version shortly.

AttachmentSize
extlink_exclude_include.patch 4.63 KB

#6

danorton - March 25, 2009 - 04:54
Status:fixed» closed

Perfect. Nice work!

 
 

Drupal is a registered trademark of Dries Buytaert.