• I whipped this up pretty quick using the filter code from Six Apart’s rel=nofollow spam catching plugin.

    Here’s the link to the plugin: http://www.phaedo.cx/includes/wpNofollow.php.zip

    The source: http://phaedo.cx/includes/wpNofollow.phps

    It basically just filters anchor tags and adds in the rel=nofollow attribute. Google, MSN, and Yahoo! all announced support today for this tag. You can read more about it here: http://phaedo.cx/archives/2005/01/18/support-for-nofollow/ there are links to everyone’s announcements.

    The comment text filtering is automatic, but if you want comment_author_link to return a link with the attribute in it, you need to replace the call to that function in wp-comments.php with the function in my script named comment_author_link_nofollow().

    this is my first plugin for WP and I’m sure I’ve not done everything 100% correct, so please feel free to comment and criticize, I can take it πŸ™‚

Viewing 15 replies - 16 through 30 (of 36 total)
  • @clintology:

    If I enter a link in the comment WITHOUT the a href etc. the plugin won’t bite.

    Here i just write in a normal link:

    http://www.orangeguru.net/weblog/

    And I get this in the source/comment

    <p><a href='http://www.orangeguru.net/weblog/'>http://www.orangeguru.net/weblog/</a></p>

    When I use the proper html syntax:

    <a href="http://www.orangeguru.net/weblog/">My Weblog</a>

    Then the plugin works (source/comment):

    <p><a href="http://www.orangeguru.net/weblog/" rel="nofollow">My Weblog</a>

    The funy thing is, if you want to apply it selectively automatically, you have to have a decent working spam detection. And if you have that, you don’t need the attribute anymore.

    One more thing:

    I like the way livejournal is implementing it. A comment from someone on your friends list will not have the nofollow, but if they are not on your friends list it will have the nofollow. (quoted from http://www.webmasterworld.com/forum5/6053.htm)

    That is a nice idea. It would be great if WP could incorporate a similar ‘whitelist’ check; that is, if the URL is included in your Links Manager the ‘no-follow’ isn’t added. That would do away with bloggers whining that their Page Rank isn’t going to be increased by posting on other blogs; though IMO posting comments with that in mind is only one step above spamming anyway.

    for spoiler hack user please apply patch (follow instruction on my site) to make this plugin work.

    http://secandri.com/blog/2005/01/19/nofollow-plugin-for-wordpress-12/

    I have to agree with orangeguru here. I just tested it and it worked great for ‘a’ links, but WordPress takes url’s and converts them into links. The converted links don’t have the rel=’nofollow’ tag in it.

    Any chance this plug-in will get updated to handle those?

    Otherwise, I can see spammers just changing there spam messages to have non ‘a’ based url’s in the post to link back to their sites.

    Thread Starter clintology

    (@clintology)

    I forgot all about the auto_linking. It seems that that filter gets applied AFTER this one. Is there any way to hook into the comment_text after all other filters?

    Thread Starter clintology

    (@clintology)

    Hey I just found out the solution, I think I can lower the priority of the filter so that it gets applied last. A priority of 10 should accomplish that.

    My wordpress installation doesn’t seem to auto link URLS (1.2.2) so I’m not sure what options you guys have set that I don’t. I changed the filter to have a priority of 10 (lowest) so that it should be the last filter to be run across the test.

    Re-download it from the site: http://www.phaedo.cx/includes/wpNofollow.php.zip and please let me know if it catches those.

    Yeah Clint, that fixed it for me.
    I changed the last two lines of wpNofollow.php to read:
    add_filter('comment_text', 'nofollowfy', 10);
    add_filter('comment_excerpt', 'nofollowfy',10);

    Thread Starter clintology

    (@clintology)

    That’s exactly what I did to update it, dleber πŸ™‚ Good to hear it works!

    I like the way LiveJournal is doing this, by letting “friends” have their links with no “nofollow”.

    This can partly be done by allowing registered users to post comments with links without “nofollow” added. For those who just post comments and not register, perhaps after x approved comments (say 5) “nofollow” will not be added for that poster’s comments.

    Another good idea is to put “nofollow” onto links for a period of time, then get rid of it (this assumes that a spam comment will be deleted at some point).

    I think a combination of all of the above needs to be done and that there should be some kind of default (not the status quo!) in WordPress. It doesn’t have to be as extreme as some blogging services adding “nofollow” to every comment, but it should be at least enough that by default the incentive to post a spam comment on a WordPress blog is not as good as it is right now.

    It isn’t perfect, but it is a good step and properly designed into WordPress it could really help our fight against comment spam.

    Please could you send your plugin to http://wp-plugins.net/ ? One-click installation and easy updates are great for lazy people like me.

    There is another nofollow plugin already there, but this one works fine for me.

    Thread Starter clintology

    (@clintology)

    Its now up at wp-plugins.net and works with 1 click install

    To add onto the other votes for discretionary control over the nofollow attribute: I’d like to point out that the blogs I comment on, I do so because they interest me and have something useful to say. I might also trackback to these same discussions on my blog, so why should I be punished because I have something actually worthwhile to say on the topic?

    I’m not comment whoring like some may think but commenting and browsing like everyone else does. If all I wanted was PageRank I would join the different pingers and whore them for hits and rank, instead I just want people that are interested in the same topics I am, to eventually browse to my site/blog.

    I do like the idea that we could have such finer controls over it as to decide that those that registered on your blog aren’t flagged, or that those that are in our friends or links list should also not be flagged, but where is the off button? We can turn most features off, why doesn’t this come with one? And I talking directly about 1.5 since this is a plugin so it’s optional.

    add a filter for comment_url also if you didnt already, thats where they’ve been spamming all my sites

Viewing 15 replies - 16 through 30 (of 36 total)
  • The topic ‘Nofollow Plugin for WordPress 1.2’ is closed to new replies.