Don’t Use Javascript to Add Nofollow Relationships

It’s probably common sense to most people, but there have been instances I’ve seen it used


Great for SEO if you use it correctly. But please don’t use Javascript/jQuery to add this rel to your external links. It simply won’t do anything, as most search engine bots don’t parse JS on your site. Using PHPs preg_replace would actually allow bots to see this relationship on your links.

Google actually does read the DOM, but not every search engine is made equally. But it also doesn’t capture the nofollow specifically, because it’s created too late in the DOM. Google will catch the link first.

Using JS for similar purposes may work well, such as adding a class to your links, but definitely not for nofollowing. It will provide you with zero functionality with many search engines. I’ve seen it happen more than once, which is why I’m putting up this quick notice.

Better yet, just add nofollow to your links manually or, if you’re using something like CKEditor, set it so that external links automatically get the nofollow relationship.