It’s just data

Adding rel="nofollow" to MoinMoin

--- MoinMoin/formatter/text_html.old    2004-02-10 16:01:55.000000000 -0500
+++ MoinMoin/formatter/text_html.py     2005-01-18 21:29:10.000000000 -0500
@@ -90,6 +90,7 @@
         # create link
         str = '<a'
         if css: str = '%s class="%s"' % (str, css)
+        if css and css=="external": str += ' rel="nofollow"'
         if title: str = '%s title="%s"' % (str, title)
         str = '%s href="%s">%s</a>' % (str, wikiutil.escape(url, 1), text)

Preventing comment spam

Randy: Awesome! And check-out the list of supporting software vendors. Sam Ruby has posted instructions on Intertwingly for adding rel="nofollow" to MoinMoin.... [more]

Trackback from The RSS Blog

at

I tried this on my wiki, and it works.  But it misses
those links that get created when you just type a URL in without
markup; those places where you just type in something like
h t t p : / / c n n . c o m / .

Posted by Don at

Don: you are right.  Looks like the simpler patch below catches everything it is supposed to, and nothing it is not supposed to:

--- text_html.py        2005-01-21 22:19:19.000000000 -0500
+++ text_html.old       2004-02-10 16:01:55.000000000 -0500
@@ -88,7 +88,7 @@
         if text is None: text = url

         # create link
-        str = '<a'
+        str = '<a rel="nofollow"'
         if css: str = '%s class="%s"' % (str, css)
         if title: str = '%s title="%s"' % (str, title)
         str = '%s href="%s">%s</a>' % (str, wikiutil.escape(url, 1), text)
Posted by Sam Ruby at

Perhaps InterWiki links are OK?  If you think so, I might suggest:

--- MoinMoin/formatter/text_html.old    2004-02-10 16:01:55.000000000 -0500
+++ MoinMoin/formatter/text_html.py     2005-01-18 21:29:10.000000000 -0500
@@ -90,6 +90,7 @@
         # create link
         str = '<a'
         if css: str = '%s class="%s"' % (str, css)
+        if (not css) or css=="external": str += ' rel="nofollow"'
         if title: str = '%s title="%s"' % (str, title)
         str = '%s href="%s">%s</a>' % (str, wikiutil.escape(url, 1), text)


Posted by Don at

Sam Ruby: Adding rel="nofollow" to MoinMoin

[link]...

Excerpt from del.icio.us/mjs/wiki at

here’s a patch for moin 1.3.4:

Index: MoinMoin/formatter/text_html.py
===================================================================
--- MoinMoin/formatter/text_html.py     (revision 158188)
+++ MoinMoin/formatter/text_html.py     (working copy)
@@ -274,15 +274,18 @@
         # create link
         if not on:
             return '</a>'
+
+        type = kw.get('type', '')
+
         str = '<a'
         if css: 
             str = '%s class="%s"' % (str, css)
         if title:
             str = '%s title="%s"' % (str, title)
+        if type=='www':
+            str = '%s rel="nofollow"' % str
         str = '%s href="%s">' % (str, wikiutil.escape(url, 1))
 
-        type = kw.get('type', '')
-
         if type=='www':
             str = '%s%s ' % (str, self.icon("www"))
         elif type=='mailto':


Posted by Leo Simons at

Add your comment