Let’s discuss how nofollow link is different from dofollow, what are the significance and use of both.
Important: If you are looking for code to set nofollow link in author bio and to open it in a new tab, scroll down. Otherwise, let’s discuss some of the important points you should know before making any changes to your WordPress blog.
If you are making changes in your code without knowing the significance, it can impact your website SEO and so the traffic.
So go through the complete article.
Here are some important questions I would like to address about nofollow link.
If you are into SEO, you might be knowing these terms.
If you don’t know, don’t worry. I’m describing these two terms briefly and what is the use of it.
rel is the property of the HTML tag
a. Dofollow and nofollow are the two accepted values of this HTML tag.
We all know that internal/external links so-called backlinks are the most crucial factor considered by Google search algorithm.
If you are a blogger and ranking your page, your page rank is calculated based on the many factors and backlink is one of that.
By default, the value of the rel is considered as dofollow. You can set the
rel property as Nofollow. When Google sees this property as nofollow, the search engine does not consider URL while evaluating your web page.
Only a do-follow link will be considered by the search engine while indexing your page.
You should know when to mark links in the article as dofollow or nofollow.
If the link is relevant to your article content, it is good to mark it as dofollow. Otherwise, mark it as nofollow.
Consider the link in the author bio. Mostly this link points to the home page of the author’s website and not necessarily relevant to the article content.
If you allow guest posts on your website, you might get multiple requests from guest author to publish their article. So, making it as nofollow is good SEO practice.
If you are running a multi-author blog, its a very tedious job editing each author profile and making link nofollow.
What if we can add a couple of lines code to make the author link nofollow and that will make the change for links in all author bio?
Yes, we can automate that. It’s just one time job.
You need to change the content in the theme file
author.php. If this file is not there check for
Most of the premium themes provide a separate PHP file for the author bio section called
author.php. If it is not there, the author’s bio code can be found in the
get_the_author_meta() and replace that line of code with the following code snippet.
<?php $author_info = get_the_author_meta('description'); $string = str_replace('href','rel="nofollow" href', $author_info); echo $string; ?>
Usually, links in the author bio are external links (link to other websites). And obviously no one likes if someone moves from your website to another website.
You can set all the links in the author bio to open in a new tab. Your article will be opened in another web browser tab when users click on the link.
You need to set target attribute to
_blank to open the link in new tab.
<?php $author_info = get_the_author_meta('description'); $string = str_replace('href','target="_blank" href', $author_info); echo $string; ?>
We can combine above code to open link in new tab and to set link as nofollow.
<?php $author_info = get_the_author_meta('description'); $string = str_replace('href','rel="nofollow" target="_blank" href', $author_info); echo $string; ?>
That’s it. Isn’t it simple?
This code is self-explanatory if you have even little knowledge of the coding. If you know the basic HTML code, it’s easy to understand.
If you are not from coding background, it is not necessary to understand to implement this. Just follow the steps I shared above.
We are making changes in the WordPress theme file. Even if you update WordPress to the new version, it does not impact our code. And it will still work.
But if you update your theme, your changes will be overwritten. The best practice is to create the child theme.
You learned about the difference between dofollow and nofillow, when you should use nofollow link and how to mark all author links as nofollow.
If you are accepting guest posts on your blog, it is good practice to set all the links in author bio as nofollow. It’s good for SEO.
If you have any questions or if you are not able to set nofollow link in author bio, let me know in the comment.