[theforum] nofollow in articles (was Re: New article)

Drs Marcel Feenstra, MALD, MBA marcel at wintasy.com
Mon Oct 15 16:56:15 CDT 2007


Hi Dave,

Thanks for your detailed reply. First of all, I wholeheartedly agree that
the comment link spam is a major nuisance that needs to be stopped!

I have reported this sort of spam on many occasions (if you came across
messages that read: "Gratuitous link drop", they were probably mine...), but
it started to appear so frequently that it seemed almost pointless to keep
reporting it. Also, I once noticed a particularly nasty case, where the
author had managed to insert *hidden* links to "adult" sites --I just
*happened* to see my cursor change as it moved over (what looked like) an
empty space, then looked at the source code (and sent an e-mail to Dean). So
I agree that the problem calls for an *automated* solution.

It is nice to see that we seem to agree that the "nofollow" should be
applied to *comments*, but not to (reviewed and approved) *articles* --the
challenge, then, is to find a technical solution that does just that.

I am by no means a Drupal guru, but I did take a quick look at the
"standard" HTML filter in filter.module that adds rel="nofollow" to all
links if enabled. In Drupal 4.7.7, the relevant snippet in function
_filter_html is:

  if (variable_get("filter_html_nofollow_$format", FALSE)) {
    $text = preg_replace('/<a([^>]+)>/i', '<a\\1 rel="nofollow">', $text);
  }

If we can find a way to execute this statement *only* for comments, but not
for regular articles (or "nodes"), I think we would have solved the problem
(without any need for *duplication* of functionality). Perhaps this can be
done by testing for $cid or $comment->cid --I will try to do some
experimenting over the next few days and/or ask around...

Marcel




More information about the theforum mailing list