Export to GitHub

lesswrong - issue #286

Comments fail to add "nofollow" for links that contain the string "lesswrong"


Posted on Mar 19, 2012 by Swift Monkey

What steps will reproduce the problem? 1. Create a comment on lesswrong linking to http://www.jefftk.com/lesswrong.html 2. Example: http://lesswrong.com/lw/7fo/open_thread_september_2011/62l1

What is the expected output? What do you see instead?

The generated html is:

  <p>Testing nofollow on
  <a href="http://www.jefftk.com/lesswrong.html">a link</a>
  that contains 'lesswrong' somewhere but doesn't point to
  lesswrong.com.</p>

I would expect to see:

  <p>Testing nofollow on
  <a href="http://www.jefftk.com/lesswrong.html" rel="nofollow">
  a link</a> that contains 'lesswrong' somewhere but doesn't
  point to lesswrong.com.</p>

The code responsible for this appears to be:

269  if not re.search('lesswrong|overcomingbias', res):
270     res += ' rel="nofollow"'

In https://github.com/tricycle/lesswrong/blob/master/r2/r2/lib/contrib/markdown.py

Solving this properly is tricky. Some links that should be left alone:

http://foo.lesswrong.com
http://lesswrong.com
http://lesswrong.com/foo

Some links that should be nofollowed:

http://www.jefftk.com/lesswrong.html
http://lesswrong.jefftk.com

Comment #1

Posted on Aug 3, 2012 by Grumpy Dog

(No comment was entered for this change.)

Status: New

Labels:
Type-Defect Priority-Low Milestone-Future