Make links NOFOLLOW with "Meta" Tag or "REL" attribute?

LyNHS

Regular Member
Joined
Jul 20, 2010
Messages
281
Reaction score
98
Hey everyone!

Just wondering if there was perhaps a way to automatically change all links posted on a certain page to NOFOLLOW Links...

I can edit the HTML, but that would be incredibly time consuming. I also have no way of editing the head section!

So, is there some sort of script that can change all URLs to nofollow without doing the rel="nofollow" attribute or meta name="robots" content="nofollow" tag?

Thanks!!!! :-)
 
If it's a static site then you could do a find and replace on all <a href> tags and re-upload them... aside from that you're pretty much up shit creek as you wouldn't really be able to differenciate between internal and external links and you'd either end up no-following all your links.
 
If you use macromedia dreamweaver just hit CNTRL + F and use the find and replace function
 
Annoyingly it isn't a static site - I'm trying to learn PHP and have built myself a, unstable at best, Content Management System that uses MySQL.

I've just create a comments section, but a comment box will appear on about 700 pages, and I'm guessing will be spammed a lot.

So, if I was to edit the HTML, all I can use is a very basic Text Editor; nothing like Dreamweaver. Also, I only want to make the comments box NOFOLLOW, everything else I want left alone ...

I guess I'm just going to research and learn a lot more about PHP ... it's just so hard!!!!!

Thanks for all your input though guys!
 
You need to put this between head tags

Note that get element by id needs to be your real comment section id (<div id="something">)
Code:
<script type="text/javascript">

function nofollows(){
var a = document.getElementById('something').getElementsByTagName('a');

for (i=0;i<a.length;i++){
a[i].setAttribute('rel','nofollow');
}

}
</script>

And edit your body tag:
Code:
<body onload="nofollows();">
 
You need to put this between head tags

Note that get element by id needs to be your real comment section id (<div id="something">)
Code:
<script type="text/javascript">

function nofollows(){
var a = document.getElementById('something').getElementsByTagName('a');

for (i=0;i<a.length;i++){
a[i].setAttribute('rel','nofollow');
}

}
</script>

And edit your body tag:
Code:
<body onload="nofollows();">

Thank you!!! I haven't tried it yet, and am going to try it later tonight ... thanks for the script it's really appreciated! Even though I can't edit anything in the "Head" tags, what I do have already in the "head" tags is a script pointing to an external javascript file ... so Ill just add it in there!

Thanks again!!!
 
use the meta nofollow that's the best way to do that
 
Back
Top