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.
Your tutorial in excellent and easy to implement. This will definitely improve SEO, but suddenly turning your “dofollow” to “nofollow” links might irk some of your guest authors. I hope you informed them about policy changes before making the decision.
Do have a nice day friend.
I actually had to do this in order to protect this domain and our guest authors from penalties incase our domain is been penalized. BTW, I actually had to add the Revenue Sharing System as a compensation.
Thanks for finding time to comment and do have a great day pal.
It has really being a while since one saw you around! Now back to the main issue on board, this is an interesting tutorial bro!
Thanks Emmanuel for dropping by. I’m glad you love this tutorial, it would really help in check mating your link out.
Once more, thanks for dropping by and do have a great day.
This is a very useful hack.Thanks for sharing this.Saves me a lot of time.
I’m glad you love it pal. Take Care.
You have given us really a good tutorail. Thanks for sharing. Apart from blogger templates wordpress themes are hard to edit for new bloggers like me. We feel worried more about php. But your article guides me we can also play with wordpress theme. Thanks for sharing such good tutorial in wordpress.
You are welcome Tharun. Thanks for your time.
I haven’t done any guest posts but I thought that was one of the reasons that people loved guest posting was for the links?
I’m sure that many people won’t mind after all when they guest post they should still be able to get a lot of extra traffic. Thanks for sharing us how to create a no follow link. Have a great day.
People guest post for link juice, but most times I do that to create a brand for myself since it attracts more traffic to more blog. The benefits to guest posting are too numerous to ignore and focus on link building alone. Thanks for finding time to comment and do have a great day ahead. 🙂
ARE YOU THAT SCARED OF THE Google Penguin updates :), DON’T MIND ME BRO. I THINK I’LL BE NEEDING THIS WHEN I START RECEIVING GUEST POSTS BUT AS OF NOW, MY BLOG IS NOT EVEN UP TO A MONTH OLD.
lol! Prevention they say is better than cure. Wishing you success in your blogging career.
I’m using a Genesis child theme and I thought I could make this work by modifying the code and doing some edits in my functions.php file but it wasn’t successful. I really don’t wanna edit Genesis Framework core files cuz it’s gonna be erased when an update is released and went ahead to use a plugin to achieve this: Author Customization.
It adds rel=”nofollow” but I had to edit the plugin to include target=”_blank”.
I’m surprised this never worked for you as it’s the exact same code I use on this blog (running a custom Genesis child theme). I only had to add the code to replace the part of my theme where PHP outputs the bio (I don’t use any author plugin though, I added authors bio using some genesis hooks). Anyway, I’m glad you could find your way around it.
Thanks for dropping by.