After the Google updates and penalties they have recently been passing on blogs due to the sites they link out to, I finally decided not to give out dofollow links on my blog. And for me to achieve this, I would have to manually edit all guest authors bio(s) in order to add the Nofollow and new tab link attribute. That was gonna be a huge task because I have lots of guest authors registered.
- Must Read: Best On Page SEO Techniques For Your Blog
On a second thought, I could have decided to run a MySQL query to search and add nofollow and blank target tags to all href tags in the users table, but I would have to do that whenever a new user registers and update their bio with dofollow links.
Moreover, the users can always login and change the links to dofollow, so it wasn’t an option for me.
After a little brainstorming, I came up with a perfect solution to this, and it would come to be quite handy if you are joining me in this.
How To Add Rel=”Nofollow” and target=”_blank” to links in Author Bio
This solution would only add the two link attributes whenever the page containing the bio profile author box is loaded, that is to say whenever a post is been loaded. It won’t actually replace the links in your blog’s database, but it would alter the display on the pages and to search engines.
We are going to make use of the PHP str_replace function. It would search for links and replace/add those tags automatically.
This part can really be tricky and if you do not want to mess around with codes, you could always Contact Me for help.
Login to your cPanel and locate the file that displays your Author Bio section. Most themes would have it in their single.php file or might come with an author.php file. For those making use of the Author Display Plugins, you would need to edit the plugin internal files to achieve this.
When you find the part that outputs the author bio, you would have to replace it with the simple code below.
$the_author_description = get_the_author_meta(‘description’);
$string = str_replace(‘href’,’rel=”nofollow” target=”_blank” href’, $the_author_description);
The code would call for all href and replace with the rel=”nofollow” target=”_blank” href tag, and this would enable all links to be loaded in a new tab when clicked and also attribute a nofollow property to them.
This would be nice on your SEO because you might not trust URLs you are linking to. I just implemented it on this blog and it works great. I hope you’ll love it.