Oct 10

Stop SEO Death By Pagination

Posted by Jaimie Sirovich on Oct. 10th, 2006. 23 comments — voice your opinion.

NEED A GREAT WEB SITE? NEED IT TO BE SEARCH-ENGINE-FRIENDLY?

SEO Egghead is a web development firm dedicated to creating custom, search engine optimized web site applications. We specialize in eCommerce and content management web sites that not only render information beautifully to the human, but also satisfy the "third browser" — the search engine. To us, search engines are people too. Click here to talk to us. We'd love to help!
X

This post is now (mostly) obsolete and replaced by WordPress SEO Pager —

WordPress SEO Pager

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.

Tell an amigo:
  • Sphinn
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Facebook



Related posts:
Updated PagerFix Plugin Code For WP 2.1 I upgraded to WordPress 2.1 today, and one of my...
3 WordPress Hacks For SE-Friendly Blog Archives Your default WordPress installation has a problem.  Your posts slowly...
WordPress "SEO Pager" Pagination Control Plugin Released! You like SEO and intuitive pagination controls? Well, we decided...
Stop Hackers With Our WordPress Firewall Plugin v1.2 Getting hacked is a total bummer, right? Right. But...
How You Can Stop Dirty Feed Scrapers In 3 Easy Steps Stealing is wrong; but some people just don't seem to...




"23 Wise Comments Banged Out Somewhere On The Internet ..."


Xuru

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

Xuru

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

Jaimie Sirovich

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.

Xuru

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?

Joe

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

AS

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.

AS

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

Shawn

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

Tim

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

Susie

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.

Susie

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

Jeremy Luebke

Do SE's follow drop down box option links?

PocketSEO

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…

SEO Plugins Wordpress | Nimicul lui Krumel

[...] 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 [...]

SEO Egghead by Jaimie Sirovich » 3 WordPress Hacks For SE-Friendly Blog Archives

[...] 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. [...]

Mike Haldas’ Blog » Plugins that I used

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

Blog Settings for SEO - Copywriters Board

[...] 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 [...]

SEO Egghead by Jaimie Sirovich » Updated PagerFix Plugin Code For WP 2.1

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

Rxbbx Dev Blog WordPress Supplemental Fix

[...] 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 [...]

SEO-sanitizing a WordPress theme in 5 minutes

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

Ask Kirsty - Why Doesn’t Google Love My Site? » UK Affiliate Marketing Blog - Kirsty's Affiliate Marketing Guide - Affiliate Stuff UK

[...] Linkage Generally - is weak over the whole site.  You might want to consider using a plugin that will stop your pages being buried a few levels deep because of Wordpress' weak cross linkage between [...]



Care To Bang On The Keys ... ?

BECOME AN EGGHEAD. SUBSCRIBE TO OUR RSS FEED!

Learn to be as nerdy as we are by never missing our latest blog entries. Receive great tips, tricks, and ideas on improving your web site every day! Subscribe via our RSS Feed or use the chicklets in the sidebar.