SEO Egghead by Jaimie Sirovich: A blog about SEO, written for nerds, by a nerd.

Choose a Topic:

» Suggest a topic or buzz to cover; if I write about it, you'll get credit with a link in the post!

Tue
10
Oct '06

Stop SEO Death By Pagination

I know of many architectural mistakes that can totally torpedo a web site's rankings -- using URL-based session IDs, adding duplicate content for fun, etc.  But one thing stands out in WordPress blogs as a culprit.  I call it "death by pagination," and it's another way to screw yourself.

It's common knowledge that pages buried deeply within a web site, for various reasons, will likely not rank as well as those that are linked from top-level pages.  Typically, the solution employed is a site map.  This mitigates the problem by creating one link to deeper pages from a page that is only 1 level deep.

Without that, simple "< prev next >" pagination causes certain items (in this case posts), to be buried several pages deep within a site structure that looks like this:

[ A -> B -> C -> D ]

Here, page "D" is 4 levels deep.  Usually, it's not linked from anywhere else, either.  In a blog, this would occur when the pagination is performed in 10s, and there are >= 31 posts in a category or month.  On my blog, that's pretty likely, and the first post in a given month would be on page "D."  Categories only get larger over time as well.

There are two approaches to fixing the problem.

1. Don't use simple-pagination.  Page with "< prev" and "next >" as well as links to the individual pages.
2. Add a sitemap

Examples of "1" can be seen on this page on one of my sites and also on the SEOmoz blog:

 

To do this in wordpress, add this little plugin:

<?

/*
Plugin Name: PagerFix
Plugin URI: http://www.seoegghead.com/
Description: Makes the paging in WP more SE-friendly.
Author: Jaimie Sirovich
Version: 1.0
Author URI: http://www.seoegghead.com/
*/ 

function pager_fix($seperator ' | '$after_previous '&nbsp;&nbsp;'$before_next '&nbsp;&nbsp;'$prelabel='&laquo; Previous Page'$nxtlabel='Next Page &raquo;'$current_page_tag 'b')
{    
    global 
$request$posts_per_page$wpdb$paged;
    
    
posts_nav_link('',$prelabel,'');
    echo 
$after_previous;
    
preg_match('#FROM (.*) GROUP BY#'$request$matches);
    
$fromwhere $matches[1];
    
$numposts $wpdb->get_var("SELECT COUNT(ID) FROM $fromwhere");
    
$max_num_pages ceil($numposts $posts_per_page);

    if ($max_num_pages 1) {

        for ($cnt 1$cnt <= $max_num_pages$cnt++) {

            if ($current_page_tag && $paged == $cnt) {
                
$begin_link "<$current_page_tag>"$end_link "</$current_page_tag>";
            } else {
                
$begin_link ''$end_link '';
            }
            
            
$x[] = $begin_link '<a href="' get_pagenum_link($cnt) . '">' $cnt '</a>' $end_link;
            
        }
    
        echo 
join($seperator$x);
        
    }
    echo 
$before_next;
    
posts_nav_link('','',$nxtlabel);
    
}

?>

Then call the function "pager_fix()" in your template somewhere.

To accomplish "2," use this plugin.  I use this plugin -- here is my sitemap.

Side Note: You can also use the links generated by the calendar control in WordPress to partially address this; but I feel this introduces other problems, including duplicate content issues.  For this reason I do not recommend it.

Of course this concept does not only apply to blogs.  I see plenty of other web sites that would benefit from fixing their paging features up like this.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • Reddit
  E-Mail This Post/Page

22 Responses to “Stop SEO Death By Pagination”

  1. Xuru Says:

    I was about to disagree with you. By adding the numbered links you just add more duplicate content issues when you have every blog post on multiple pages. The category pages, the numbered link pages, and the actual blog post.

    Then I noticed you fixed this on your site by only providing a snippet on any page but the home page and the actual blog post. Genius. Now can I please have that plug-in? :)

    Thanks
    Jeremy Luebke

  2. Xuru Says:

    Since adding your plugin I get the following error any time I try and activate a new plugin.

    Warning: Cannot modify header information - headers already sent by (output started at /home/xurucom/public_html/blog/wp-content/plugins/pagerfix.php:1) in /home/xurucom/public_html/blog/wp-includes/pluggable-functions.php on line 272

  3. Jaimie Sirovich Says:

    Make sure you don't have any whitespace in the plugin file, and you want to put it in your plugins directory instead.

    So ... put it in wp-content/plugins as filename pagination-fix.php, enable it, then call my function instead of the native pagination control generation functions.

  4. Xuru Says:

    Looks like I had some extra spaces in there.

    So will we get a chance to know how you did the "Excerpt:" thing in the archives?

  5. Joe Says:

    Hi,

    Great plugin but small problem...it breaks my admin section. It doesn't just break it it makes it completely vanish, returning only a blank white screen. Very strange.

    The other plugins I have active are:
    Advanced WYSIWYG Editor By Assaf Arkin.
    Akismet
    Dagon Design Sitemap Generator 2.7
    Google Sitemaps 2.7.1
    Google Analytics 1.7
    Ultimate Tag Warrior 3.141592
    Search Excerpt 1.2 $Rev: 19 $

    Any insight appreciated.

    Cheers,

    Joe

  6. AS Says:

    Hi

    I am interested in the functionality of this. I already use a pagination plugin on my site but have one issue.

    It produces

    >

    So I can go forward and back one page.

    Your plugin seems to be similar. I have over 500 posts (say) on my site.

    When I use your plugin it produces about 125 links (i.e. 500 / 4 per page).

    What I really would like is to have

    >

    Just an idea, not sure if you can do that with your plugin.

  7. AS Says:

    Well my previous reply didnt work too well, translated the less than and greater than into html :-)

    Try again without less than and greater than

    My point was - I would like a plugin that does something like this
    Prev 1-10, 11-20, 21-30 Next

  8. SEO Plugins Wordpress | Nimicul lui Krumel Says:

    [...] Posts Pagination Related Entries Customizable Post Listings Landing Sites Plugin Cu mai multe pluginuri aici Site-ul e in germana si deci am fost nevoit sa il traduc cu Altavista. Link-ul normal e acesta: WP - Landingsites de (Plugin) Subscribe to Comments 2.0 [...]

  9. SEO Egghead by Jaimie Sirovich » 3 WordPress Hacks For SE-Friendly Blog Archives Says:

    [...] Your default WordPress blog has a problem.  Your posts slowly get pushed into "pagination death" as they age; your older trusty content gets buried deeper and deeper internally.  Furthermore, duplicate content issues plague your category and main listing pages. [...]

  10. bongobelly.com | web/dev, For everyone. » Blog Archive » Stop SEO Death By Pagination Says:

    [...] A wordpress must-have. http://www.seoegghead.com/blog/seo/stop-seo-death-by-pagination-p118.html [...]

  11. Mike Haldas’ Blog » Plugins that I used Says:

    [...] Also, here is a link to pagination for wordpress: http://www.seoegghead.com/blog/seo/stop-seo-death-by-pagination-p118.html Bookmark to:          [...]

  12. Blog Settings for SEO - Copywriters Board Says:

    [...] Re: Blog Settings for SEO - Today, 04:18 PM Brian, I assume you're talking about your front page. It's fine that you have excerpts leading to articles. But I would link to more article pages or the comments section using the blog's simple pagination rules. Here's an article on this: SEO Egghead by Jaimie Sirovich » Stop SEO Death By Pagination As far as adsense goes, I have found that adding them is benign or negligible. In fact, adding adsense forces google to crawl your blog. Michel Fortin TheCopyDoctor.com [...]

  13. Shawn Says:

    This great plugin seems to be broken in WordPress 2.1 RC1. I really hope dev continues! Thanks.

  14. Tim Says:

    Yeah, I'm now getting this error with WP 2.1 and need some help:

    WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]

    SELECT COUNT(ID) FROM

  15. Susie Says:

    I have been able to successfully implement the Pagerfix plugin as well as your duplicate content hack and your suggested site map into my site. However, the Pagerfix plugin is having issues with WordPress 2.1. The error message I get is:

    WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
    SELECT COUNT(ID) FROM

    I was getting the same error message from the MW 1.1 theme by Javier GarcĂ­a at http://www.monetizingtheweb.com/wordpress-theme-mw/ but he has fixed the theme by adding:

    if ($wp_query) $max_page = $wp_query->max_num_pages;
    else{

    to his pagination. I tried to use his fix to make a similar change but apparently they are different problems. I do not know if that will be any help.

    I know you are busy and not fealing well, but if you get a chance, perhaps you can take a look at this and give us some suggestions.

    Thank you for your consideration.

  16. Susie Says:

    I believe I have found a solution in a plugin by Lestor Chan, WP-PageNavi 2.10 at http://www.lesterchan.net/wordpress/readme/wp-pagenavi.html

  17. Jeremy Luebke Says:

    Do SE's follow drop down box option links?

  18. SEO Egghead by Jaimie Sirovich » Updated PagerFix Plugin Code For WP 2.1 Says:

    [...] old documentation/blog post is here. These icons link to social bookmarking sites where readers can share and discover new web [...]

  19. WordPress subpages going supplemental: the fix - SEO Blog - Joost de Valk Says:

    [...] Stop SEO Death By Pagination [...]

  20. Rxbbx Dev Blog WordPress Supplemental Fix Says:

    [...] Links: - WordPress subpages going supplemental: the fix - Stop SEO Death By Pagination - 3 WordPress Hacks For SE-Friendly Blog Archives - Professional Search Engine Opimization with [...]

  21. PocketSEO Says:

    It's a good idea, but SEOmoz was not doing it for that purpose. When they had those links on SEOmoz they were rel=nofollowed...

  22. SEO-sanitizing a WordPress theme in 5 minutes Says:

    [...] eliminate the built-in death by pagination flaw –also outlined here–, you install PagerFix from Richard’s buddy Jaimie Sirovich. [...]

Leave a Reply