Adding NoFollow to Any Links Generated by WordPress
September 8, 2008 by Louis Liem
Filed under Blogging Insights

This is a follow up article to my most recent writing about Managing Your PageRank Flows. In the article I wrote about blocking PR leaks by nofollowing links to pages which aren’t vital getting a high ranking on search engines.
The pages to be considered, where and how you can nofollow the links are as follows. Basically you need to find a code which says a href and then add rel=”nofollow” between the “a” and “href”:
- the links to your own homepage - usually they can be found in the header.php or footer.php and embedded in a code looks like this:
<a class="on" href="<?php echo get_option('home'); ?>/" rel="nofollow">Make Money Blogging</a>
All you need to do is adding rel=”nofollow” like the above to block the link.
- your feed links - find any codes that says links to your feed and add rel=”nofollow” in similar manner as above.
- your date archive links - you can either delete the links if most of your blog’s content is not time based, or follow the instructions using a plugin below.
- page navigation links - usually shows up in your index.php file, look for the phrase “Previous Entry” or “Next Entry” or anything depends on your theme. Add a rel=”nofollow” between “a” and “href” within the code.
- links to enlarged pictures - same as above, add the rel=”nofollow” to the linking code.
- commentator names - this is by default nofollowed
To add nofollow to links beyond this point requires modifications to your original WordPress script. Please back up your WordPress files before comitting the mods since I can not be held responsible for any errors that may occur. There’s also a WordPress plugin that allows you to do nothing at all to WordPress files, but it requires a little bit more coding knowledge, though. I’ll ahow you right after this section.
Find the functions within the following files and add rel=”nofollow” between every “a” and “href” inside the function:
- wp_generate_tag_cloud, get_the_category_list, get_the_term_list within the file /wp-includes/category-template.php - this will add nofollow to tag cloud and category links.
- edit_post_link within link-template.php - this will add nofollow to “Edit this post” link if you’re logged in as your blog’s admin.
- the_author_posts_link within wp-includes/author-template.php - this will add nofollow to author links. An easier method is available if your blog only has one author is to delete all the links referring to the author’s page.
- comments_popup_link within wp-includes/comment-template.php - this will add nofollow to links within the comment section.
Now, I’ll show you the plugin Stephan Miller told me which enables you to add nofollow without having to touch the WordPress original files at all. First, please download the Add Link Attribute plugin and activate it. According to the instruction, you need to replace the function calling the linking codes within your blog’s theme with the plugin’s own function.
For example, I’ve done nofollowing my pages link using the plugin. What I did was, I looked for the codes to display the pages links on my header. I found them inside header.php. It originally looked like this:
<?php wp_list_pages('title_li='); ?>
Then, I replaced the codes with the plugin’s function:
<?php add_link_attr('wp_list_pages', 'title_li=', 'rel="nofollow"'); ?>
Now I’ll try to explain what to be included within the code and how it can be applied for other functions.
First, the original code from the function looked like this:
<?php add_link_attr('function', 'arguments', 'attribute', imgtag); ?>
Then, you need to alter the word “function” with the function you want to replace. In my case, it was the function displaying the pages links, which was wp_list_pages. How can I know which functions to replace? Easy. Look for them inside your theme codes.
Therefore, after knowing which fucntion to be replaced, the plugin code will be like
<?php add_link_attr('wp_list_pages', 'arguments', 'attribute', imgtag); ?>
Next, you need to replace the word “arguments” with the value usually accompanying the function you want to replace. The value is written within the brackets after the original function’s name. In my case the function wp_list_pages was originally written wp_list_pages(’title_li=’). That makes the plugin code appears like
<?php add_link_attr('wp_list_pages', 'title_li=', 'attribute', imgtag); ?>
Not so difficult, isn’t it? Further, the “attribute” word is where you write any attributes you want to add. Since we’re talking about adding nofollows to links, then the “attribute” will be replaced with rel=”nofollow” so it looks like
<?php add_link_attr('wp_list_pages', 'title_li=', 'rel="nofollow"'); ?>
That leaves one more word in the plugin’s function to be replaced, that is imgtag. Since the instructions says:
imgtag (boolean) Insert attribute(s) into img/image tag ( TRUE), or into a/anchor tag (FALSE). Defaults toFALSE.
and we’ve got nothing to do with it, we can leave the value empty. Finally, the final form of the code to add nofollow to pages links will be:
<?php add_link_attr('wp_list_pages', 'title_li=', 'rel="nofollow"'); ?>
For more explanations and examples of this great plugin, please go to the plugin’s homepage.
I guess that’s all and I hope you find the tutorial useful. Drop any of your questions below and I’ll try my best to assist you.
Avoid Wasted PageRank Juice - Why Would You Do These Blogging Tips?
August 30, 2008 by Louis Liem
Filed under Blogging Insights
This article will show you how not to waste your hard earned precious PR juice .

photo by Jaye_Elle
Whatever your opinion to PageRank , the higher it is, the better it will effect your blog. Especially if we concern much about PR, we have been busy in our effort to get the highest boost of PageRank in the next update . A lot of effort has gone into it, hours of creating contents, dropping comments, introducing ourselves and articles which probbly spend numerous countless nights.
However, let us not forget that in order to make those link building attempts effective, we need to tweak some parts of our blog as well (some of us may find more things to optimize than others
.
I’m talking about how your blog/site carries and distributes link juice it receives from another blog/site. There’s one matter you need to know:
patch the holes and pass on the flows

photo by vrogy
Imagine there are 100 dofollow links pointing to your front page. And on the page, you link to your individual articles, categories, date archives, tag clouds, policy page, and of course your feed subscription link . Between all those pages, which one will be the most suitable to rank the highest on the search engine result pages (SERP)? I’m sure you agree that it’s the individual post pages. You don’t need your policy page to rank #1 on SERP more than your featured post, do you?
You can start re-arranging how your blog handles links by adding nofollow to internal pages you don’t need them to appear on search engines. Or at least, you don’t need them to rank high. Internal links to consider are :
- the link to your own homepage - people say the more links pointing to a certain page, the higher the page will rank.
It’s true…if the link comes from a different domain
Update: I apologize for the rushing statement above. Internal linking does have a significant contribution for a page’s rank. Even so, you still have the option to nofollow your homepage link in order to pass more rank to other pages. But please keep in mind that it may lead to a drop of your homepage’s PR. - your feed link - some of you may disallow your feed to be indexed. This way, there’s no use to link them with dofollow since search engines won’t list them. If no one will see it, no use to dress it. If for any reasons you allow indexing of your feed, nofollow is still needed. Unless you want to generously flow your hard earned gold links to Feedburner or Feedblitz which they already abundantly have.
- your tag cloud, date and category based archive - I set my robots.txt to block search engines from indexing those pages. That’s why, for the same reasons as above, links to them don’t need to be dofollowed.
- your policy page - Simply put, there’s still a lot of thirsty new articles gasping for fresh link juice.
- your sitemap page - You don’t need to have your sitemap indexed if you have submitted it to search engines. Less pages indexed means you can feed more articles the dofollow links.
- links to your authors page - Some of you may need the authors page to get a good SERP. Some who don’t can no-follow these links.
- links to edit your post - Definitely no-follow in my opinion
- links to categories archive - It also depends on if you’d like the categories archive page to hit the #1 page of Google or prioritizing the individual posts. I myself prefer my individual posts rather than categories archive pages.
- links to the comment section - It’s useful for navigation, but I suggest to address them no-follow.
- page numbers navigation - If your categories archive is divided into multiple pages and you don’t follow links to your category archives, then you need to follow it up by no-following page number links.
- subscribe to comments links - Usually they point to your feed service. But if they go to your own feed address, you can no-follow them for the same reason as #2
- links to enlarged pictures - Some of you may value pictures higher for your topic/niche, so the decision depends on your purposes with those pictures.
- blogroll…? - The decision is completely up to you
. But don’t let them know what you’re doing
- links to popular pages - like google.com, facebook.com, you name them. Again, the decision is yours. If you feel like giving them a credit, do so.
- commentator names - Depends on whether you’re following your commentators or not, you can always switch the to no-follow/do-follow.
Before looking for more links to no-follow, I’d like to remind you of links you SHOULD follow . Not much, they are supposed to be your theme author link, your blogroll (depends on you), links your posts are referring to (if any) and sites/blogs inspire your posts.
If you would like to know what your PageRank will be on the next update, you can go to this PageRank Calculator to estimate the coming value of your PageRank . The tool calculates the result by processing your current PageRank, your inbound and outbound links. Therefore, you can plan your link building more strategically. With the PageRank Calculator it is easier to target a specific PageRank value for a given page as mentioned in micro managing your PageRank .
click on the image to view
Hopefully before applying further link-building strategy , you can provide some time to analyze your link flows and optimize them to get the best results.
Update:
- Stephan Miller suggested me two awesome plugins to add nofollow to links in archives pages and another one which will allow you to code “nofollow” into normal wordpress functions like for category list widgets and page list widgets. Check his comment in # 4 below.
- For a guide on how to add the nofollow tag to your links, please go to the Adding Nofollow to Any Links article.
- There’s another point of view by Mani Karthik regarding how PageRank juice is distributed. In his quick SEO tip, he explained that the PR value of the giving page is not affected by how many links the page links to. Instead, the receiving pages are the ones affected. While my article and his are having a different opinion on how linking influences a certain page, both of them show you that PageRank value is dynamic and transferrable. Therefore, you can use both articles as reasons to manage your PR.
Weekly Link Share on HomeBiz Resource
August 10, 2008 by Louis Liem
Filed under Blogging Insights, General Tips
This is the first link love or weekly roundup or whatever people name it. I’m still figuring out for the best name for it but let’s just use that at the moment . Besides, it’s the content that matters, right?
-
Using The Wordpress Discussion Filters - Fighting Comment Spam - Jeremy’s methods of reducing spam comments using Wordpress’ discussion filter system via moderation and blacklisting. You’ll see how powerful the feature is.
-
Top 10 social media misconceptions - Noah Elkin compiles 10 social media misconceptions and corresponding implications for your search marketing campaign.
-
5 Must Have Firefox add-ons for Social Media Addicts - Uzair lists 5 Firefox add-ons which save him a lot of time and also enhanced his social media experience. If they work for him, at least one of them must be doing the same for you.
-
Top 10 Javascript slideshows, carousels and sliders - 10 cross-platform, absolutely stunning slideshows, carousels and sliders, based on Mootools, JQuery, Yahoo! User Interface, and Script.aculo.us. Eye catching scripts to display your content.
- Quick SEO Tips - Can linking to other sites harm my Page Rank? - Mani Karthik adresses many bloggers worries about having a long blogroll’s impact on SEO.
- How To Get to the Front Page of Digg - 6 Ingredients of a Successful Digg Campaign - We’ve seen many tips to be on Digg’s front page. But reading another 7 (his last tip is Don’t become obsessed with Digg) from Darren won’t hurt. Not only he listed them, but clear explanation were also given. Worth the stumble…and Digg of course!
- A Complete Guide to Finding and Using Incredible Flickr Images - Skellie explains the types of photos copyright in Flickr and a guide to find the photos to spice up your blog posts.





