No Follow links in user posts - Posted (1864 Views)
Starting Member
Loyola05
Posts: 24
24
I haven't seen this MOD posted, but I thought it could be valuable. As users often post links to their own websites, this prevents your forum from sharing your page rank with moochers.
In the file inc_func_common.asp, there is a JavaScript function at the very end of the file (this is the last 27 or so lines).
Replace the exisiting code with the following:

Code:

<script language="javascript1.2" runat="server">
function edit_hrefs(sURL, iType) {
sOutput = new String(sURL);

if (iType == 1) {
sOutput = sOutput.replace(/\b(http\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$1<\/a>");
} else if (iType == 2) {
sOutput = sOutput.replace(/\b(https\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$1<\/a>");
} else if (iType == 3) {
sOutput = sOutput.replace(/\b(www\.[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"http://$1\" rel=\"nofollow\" target=\"_blank\">$1<\/a>");
} else if (iType == 4) {
sOutput = sOutput.replace(/\b([\w+\-\'\#\%\.\_\,\$\!\+\*]+@[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+\.[\w+\.?\-\'\#\%\~\_\.\;\,\$\!\+\*]+)/gi,
"<a href=\"mailto\:$1\">$1<\/a>");
} else if (iType == 5) {
sOutput = sOutput.replace(/\b(ftp\:\/\/[\w+\.]+[\w+\.\:\/\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$1<\/a>");
} else if (iType == 6) {
sOutput = sOutput.replace(/\b(file\:\/\/\/[\w+\:\/\\]+[\w+\/\w+\.\:\/\\\@\_\?\=\&\-\'\#\%\~\;\,\$\!\+\*]+)/gi,
"<a href=\"$1\" rel=\"nofollow\" target=\"_blank\">$1<\/a>");
}

return sOutput;
}
</script>

If you look carefully, the only thing I have added is rel=\"nofollow\" to several of the links.
As far as I can tell, this only works for links posted in the message area and footer - if you allow users to post a Homepage in their profile, the homepage icon (displayed in their post) will not have this rel="nofollow" attribute.
I'd love some feedback on this MOD - let me know if there are more suggestions. My site's forum (http://www.whyilovechicago.com/forum) implements this MOD, so you can see it in action (although, since it's new, I don't think any users have posted links yet). I have also used this MOD on my former company's forum (http://www.fathomseo.com/forum).
Thanks!<
Art
http://www.whyilovechicago.com
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Support Moderator
Podge
Posts: 3776
3776
Been done before - http://forum.snitz.com/forum/topic.asp?TOPIC_ID=59382#336266<
Posted
Starting Member
Loyola05
Posts: 24
24
I figured someone had to have done that before... but I searched for like 20 minutes trying to find it here and I couldn't locate that thread.

Anyways, the post you link to speaks of parsing URLs for hyperlinked text, and doesn't mention the reasons behind using rel="nofollow" in terms of SEO or link crawlers/spiders. Maybe this can/should be listed as a specific MOD for that reason, and not lumped in with parsed URLs.<
Art
http://www.whyilovechicago.com
Posted
Average Member
blackinwhite
Posts: 657
657
Originally posted by Loyola05
I figured someone had to have done that before... but I searched for like 20 minutes trying to find it here and I couldn't locate that thread.

Anyways, the post you link to speaks of parsing URLs for hyperlinked text, and doesn't mention the reasons behind using rel="nofollow" in terms of SEO or link crawlers/spiders. Maybe this can/should be listed as a specific MOD for that reason, and not lumped in with parsed URLs.

thank you, I start to use it. ;)<
 
You Must enter a message