Welcome to WebmasterWorld Guest from 54.242.138.24

Forum Moderators: not2easy

Message Too Old, No Replies

Can I use CSS to add rel="nofollow"?

     

SilverSpirit

1:46 am on Mar 18, 2012 (gmt 0)

5+ Year Member



More precisely: I have an RSS news feed on my site. I can control its appearance with CSS. Can I use CSS to automatically add the rel="nofollow" attribute to all links in that feed?

g1smd

2:47 am on Mar 18, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



No. CSS is all about styling.

SilverSpirit

2:54 am on Mar 18, 2012 (gmt 0)

5+ Year Member



Hmmm maybe php, then? If my current rss php is
<?php readfile('http://my_feed')?>

Is there any code I can add to this, so that <a> tags are added the rel="nofollow" attribute? Something along these lines:
$('#a').attr( 'rel', 'nofollow' );

garyr_h

5:11 am on Apr 19, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could do it with preg_replace/match using regex. I don't think you would want to be using jQuery to be telling search engines that you distrust a link.

SilverSpirit

6:22 am on Apr 19, 2012 (gmt 0)

5+ Year Member



Actually I have got help from the excellent guys of Rssinclude in the meantime, and I now have a script that adds nofollow to all news links.

It's only natural to distrust news sites; isn't it? :-)

rocknbil

4:37 pm on Apr 19, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



What if the Javascript (jQuery) doesn't execute? Many S.E.'s don't parse Javascript. So if it "looks like it works" it's only because you have JS enabled.

The only solid solution is the one suggested above - grab the feed content, use preg_replace to add nofollow to the link, then output the modified content.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month