Wednesday, Jan 19, 2005

rel = "nofollow"

For those of you who can compile .Text, I recommend a quite edit to help* reduce the effectiveness of comment spam.

The class to change is Dottext.Framework.Util.Globals. Method: EnableUrls (found in Dottext.Framework\Util\Globals.cs)

In this method, .Text will look for links posted in a comment (prior to this call the entire comment is HtmlEncoded).

Before: text = text.Replace(m.ToString(), "<a target=\"_new\" href=\"" + m.ToString() + "\">" + m.ToString() + "</a>");
After:   text = text.Replace(m.ToString(), "<a rel=\"nofollow\" target=\"_new\" href=\"" + m.ToString() + "\">" + m.ToString() + "</a>");

Community Server already had something "home grown" baked in, but was updated ealier today to support nofollow.

* I seriously doubt this will stop spammers, but anything we can do to make not worth the effort the better off we are. See: BrokenWindows

 

Filed under:

Trackbacks

Use the following link to trackback from your own site: http://scottwater.com/blog/trackback/17153/

  1. TrackBack Wrote:
  2. TrackBack Wrote: .TEXT nofollow
  3. TrackBack Wrote:
  4. TrackBack Wrote:
  5. TrackBack Wrote:
  6. TrackBack Wrote:
  7. TrackBack Wrote:
  8. TrackBack Wrote:
  9. TrackBack Wrote:
  10. TrackBack Wrote:
  11. TrackBack Wrote:
  12. TrackBack Wrote:
  13. TrackBack Wrote:
  14. TrackBack Wrote:
  15. TrackBack Wrote:
  16. TrackBack Wrote:
  17. TrackBack Wrote:
  18. TrackBack Wrote:

Comments

  1. Eric Maino Wrote: Couldn't we implement some form for word verification for the comments helping to allieviate the issue of comment spam?
  2. Brian Swanson Wrote: Just FYI...

    Your title is correct, but the code you've listed to replace with has a typo.

    You show ref=\"nofollow\" and it should be rel=\"nofollow\"
  3. Thomas Freudenberg Wrote: Another way to add the rel="nofollow" attribute for .Text .96 is implementing an event handler. I've posted an description here: http://thomasfreudenberg.com/blog/archive/2005/01/19/486.aspx
  4. TDavid Wrote: CAPTCHA is definitely a better solution for dealing with comment spammers.
  5. Anatoly Lubarsky Wrote: I agree, CAPTCHA is a better solution
  6. Haacked Wrote: Hi Scott,

    This works for URLs within the body of a comment but if the user specifies a URL in the URL field, it doesn't modify that URL.

    Here's an example.

    <a id="Comments.ascx_CommentList__ctl13_NameLink" href="http://www.StillGettingGoogleJuice.com/" target="_blank">Comment Spammer</a>