Implement "nofollow" for hand–coded sites? Jan20 '05

What’s already known

Blog writers/readers have been happy at the recent announcement from Google, regarding the new attribute that will hopefully deter comment spammers from gaining their cheap glory.

The goal is for blog software developers to simply place the attribute/value, rel="nofollow", inside any link element that a user adds to a comment.

For example, if I write a comment on a blog with a link in the body of my comment – the link will (should) contain the rel="nofollow" attribute/value, such as:

<a href="http://www.mysite.com/" rel="nofollow">Check out my link</a>!

Google states those types of links will not get credit when they rank websites in search results, which is a big reason why comment spammers do their dirty work.

Do all bloggers need to act?

No. Only the blog software developers have to act. They just need to include this feature in the next update of their software, and then everyone USING that software (whatever it may be) will benefit.

What if I don’t use any blog software?

Here we go.

I currently don’t use any blog software. I never have. I know hundreds of people that don’t, as well.

I code my site on my own.

So, in reality, some of us DO have to make a small change – if we are so inclined.

How do I make the change?

I’m not sure yet.

Quite simply, whenever someone leaves a comment on your site, a test must be performed to see if there is a LINK included within that comment. In other words, we have to test for an <a> element.

If there is indeed an <a> element within the comment body, then the attribute/value rel="nofollow" must be included inside the <a> element.

How this is accomplished in PHP, I’m not sure. I say PHP, because that is my programming language of choice.

If anyone has any scripting ideas on how to conduct a simple find/replace function in PHP, that inserts the rel="nofollow" attribute/value within <a> elements, please comment.

Categories: Web Development , Web Sites

Add Feedback (view all)

Leave feedback

Feedback

Input format: The editor controls below will assist with Markdown syntax.

Status

Sub-status

Your info

it should be easy, just use a regex while validating/saving the comment :) I stared php only recently so i can’t give you PHP code but ... Read more.

ups, validating ate my code... and i just noticed i’m kinda late for this one LOL ... Read more.

Zombie, I made your code sample visible. Thanks for the idea. And, no, you’re not late - I keep comments open for that reason. ... Read more.

matthom is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago. Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.

Contact Matt

Similar Entries

Stats

3 unique visits since December 2008

Syndicate

Advertisements