How to Show Top Commenters Only On Your Index Page

I recently wrote that I don’t like Top Commenters plugins, in fact I used a very strong word… loathe. There are some benefits to introducing Top Commenters to give some level of special recognition, but whatever SEO benefits you think it might offer are discounted by having it placed in your sidebar across the whole of your site including your duplicate content pages.

What you give with one hand you take away with another

If you are giving away all your Google Juice from your sidebar, then you get less juice for

  • Your own pages
  • The links to sites in your content
  • The links from your comments

This isn’t just a problem with Top Commenters, it is also the same with blogrolls, and I have discussed that in the past as well.

There is some WordPress Logic you can use for all page elements depending on whether you are using widgets or not.

If you are using widgets, you would probably have to use a variant of the text entry box that allows PHP – I don’t monitor developments with WordPress widgets too much, but in the past I have found the way they are implemented in most themes to be too much hard work to customize where things appear, and on which pages. I don’t know of a version of widgets that allows drag-and-drop and total control over the placement of widgets on specific pages.

If you are using normal sidebar.php code, then you can use something like the following code.

There are a number of Top Commenters plugins, I have just grabbed the code insert from one example.

<?php if ( is_home() ) { ?>

< ?php
if(function_exists('fp_get_topcommenters')) {
echo fp_get_topcommenters();
}
?>

<?php } ?>

If you wanted the Top Commenters to appear on both your homepage and your single pages (the ones that permalinks point to), then you would use something like this:-

<?php if ( is_home() || is_single() ) { ?>
< ?php
if(function_exists('fp_get_topcommenters')) {
echo fp_get_topcommenters();
}
?>
<?php } ?>

There are lots of conditional flags that can be used within WordPress in this manner. Here are some others but it might not be an exhaustive list.

is_home()
is_paged()
is_search()
is_attachment()
is_single()
is_category()
is_author()
is_archive()
is_404()

There is also a function with Ultimate Tag Warrior, but you should ensure that UTW is installed in the same statement just in case you switch it off.

<?php if ( function_exists('is_tag') and is_tag() ) : ?>

Most themes already use similar code for various elements for the sidebar and in the headers.

Watch out for multiple occurrences of the logic in various files such as

sidebar.php
home.php
index.php
tags.php
single.php
page.php
archives.php

Some themes just include the sidebar.php on all pages. In this case you might have to use lots of nested logic to achieve the level of control you require.
Other themes only use sidebar.php on pages that use index.php, and have custom code for single.php – this allows you to use slightly less logic, but means you have to edit code in multiple places.

Liked this post? Follow this blog to get more. Follow

Comments

  1. says

    Great post Andy,

    While I have taken down the top commentators plugin, I do have blogroll, but now only on home page of my blog.

  2. says

    I am glad content like this helps people.

    Also note that different blogs have a different purpose. Some of what I talk about might be more suitable on niche sites.

  3. says

    I’m not sure I buy the whole “leaking page-rank” theory. Lots of the highest PR blogs and sites are heavy, heavy linkers.

    Has anyone ever confirmed the supposed PR leakage?

  4. says

    If you are gaining 100 links for your every utterance, you can afford to be a little bit lax in your SEO efforts, but until that time and you have 50,000 subscribers, it is good to try to maximise the return for any links you obtain.

    Search engines definitely have stated they discount the value of site wide links in the sidebar.

    For basic information on Pagerank, Revenge of the Mininet (it is available for free) is a very good read, but the strategies are hard to implement on a blog with so much external linking.

    Don’t forget I am one of the strongest supporters of dofollow which still gives links to commenters, but from within content.

    I cultivate Google Juice, not hoard it

    Most pro SEO would tell you to have noindex follow in the metatags of all those duplicate content pages, which is even more extreme, and in my opinion has a negative affect of relevance.

  5. says

    I quite like the idea of the Top Commentators plugin, but have now taken your conditional tags advice so that it shows only on the homepage not the post pages or anywhere else.

    Thanks

    db

    • says

      I am sorry but you can’t use WordPress like plugins with Blogspot. If you were hosted on your own domain you could probably totally replace the comment system. Much easier to just switch to WordPress.

  6. translation says

    The key for the top commentators is that it should not be on every page. I think that the Top Commentators plugin is an essential part of Web 2.0. We need to build communities and if we do not recognize participation then it reduces the sense of community. However, as you rightly point out every page is overkill. You want participation – and there are various ways of recognizing that participation. This is one way.

  7. translation says

    The key for the top commentators is that it should not be on every page. I think that the Top Commentators plugin is an essential part of Web 2.0. We need to build communities and if we do not recognize participation then it reduces the sense of community. However, as you rightly point out every page is overkill. You want participation – and there are various ways of recognizing that participation. This is one way.

  8. naas says

    This is looks like a vary great thing to do if there is any other ideas that will help please let me know
    thank you and keep up the good work

Trackbacks