Even better "Better URL filter"? 8-)

AlexisWilke - March 21, 2009 - 23:31
Project:Footnotes
Version:6.x-2.x-dev
Component:Footnotes.module
Category:feature request
Priority:minor
Assigned:Unassigned
Status:by design
Description

Hi there,

I was wondering if it would be possible to have two additional features in the Better URL filter:

1. If the URL domain name (between the // and first /) ends with example.com, skip the URL altogether. That way we avoid many broken links

2. Automatically add a nofollow for external links.

I guess there are modules to handle #2 so that's probably less important, but for any URL that you tweak, you could very easily test for #1.

If you are willing to include such support, I'd offer a patch at least for #1.

Thank you.
Alexis Wilke

#1

hingo - March 22, 2009 - 09:02

Hi Alexis

Actually, on first sight, I don't agree at all with 1. For the purposes of this module, if it looks like a url it should be converted.

I do get your point though, if you had used example.com a lot, your text will look funny since it is not intended to be a link. There is a workaround available for you: Anything written inside <code> tags will never be converted.

For 2) this feature already exists in the HTML Filter module. You should make sure it is turned on there, and that Better URL filter is executed before HTML Filter (a good ordering anyway).

Do you think these answers provide what you need?

#2

AlexisWilke - March 22, 2009 - 11:08

This is why #1 is a good idea:

http://www.example.com/why/is/this/a/link

And a lot of people make use of this.

Okay, an even better solution is to make it look like a link, but to not create a link. That is, the color of the link is still neat to have, but the fact that you can click on it is annoying.

I'll play around with the HTML Filter to see whether I can indeed do what you are saying. I don't recall seeing support for tweaking only external links, but that's a while back I check those options.

Thank you.
Alexis Wilke

#3

hingo - March 22, 2009 - 15:57

Actually, I don't know if the HTML filter can differentiate between in-site and external links. Even so, that's still a question for HTML filter rather than this filter.

#4

AlexisWilke - March 23, 2009 - 06:31
Status:active» by design

Hmmm... Better URL is not in the core for what reason already?! 8-)

I guess I can always create my own separate filter.

I checked HTML Filter in more details to see whether I could use it, and indeed, they would transform all the links, not just these or those. I'll look around. Maybe someone else has done such a filter.

Thank you.
Alexis Wilke

#5

hingo - March 23, 2009 - 10:22

I know I know... Even so, I want to maintain my module as if there is some coherence to it, it is not intended to become a collection of everything that should be in core but isn't. So yes, you are unlikely to have any success patching HTML Filter, but even so, then you could maybe fork HTML filter and do the little change you need, this is not the right place for it.

As I said, for your request #1 you can use code tags to avoid the URLs to become clickable. If you wanted them formatted as links but not being real links, then again this is the job for a new type of filter. Actually, you want the opposite from what Better URL filter does: Here I want to find URL's and make them into links, not minding about how they look. You want to find a certain type of URL and make it look like a link but not be a real link.

The good news is, with the Drupal filter system you can also combine these, so you can develop a simple filter that does what you want for example.com, then let Better URL filter do what it does. This is the reason one filter should usually try to not do too many things at once.

 
 

Drupal is a registered trademark of Dries Buytaert.