Paginated posts, also known as multi-page posts, can be an indispensable tool when publishing long posts. Our Core i7 860 overclocking article, for example, is 10 packed pages of stats and images.

WordPress handles this task with ease, by offering the nextpage tag in the post’s visual editor or directly with the wp_link_pages() function.

Using this feature in recent versions of WordPress, however, results in only the first page being indexed by Google and other search engines. Subsequent pages are unsearchable. In this article, I will show you how to fix this problem easily so that all your pages get indexed.

Causes of the Problem

Update May 27,2012: The newest plugin version now properly shows the Canonical URL on paginated posts, so we no longer need to modify it.

The major issue is the recent addition of canonical URLs in WordPress and their support by Google. No matter which page you are on, the canonical URL is always set to the first page. This causes Google to always refer back to the first page when it tries to crawl subsequent pages.

You will have to contend with the title and description. These two items are, by default, the same for all pages in the post.

How to Fix the Indexing Problem

This fix assumes you are using the All-In-One SEO Pack plugin. If you are in the minority who do not use it, then you just need to find the spots where your canonical URL, title, and description are finalized. These changes were made under WordPress 2.9 – WordPress 3.3.1 and the SEO plugin 1.6.13.4 (as of June 1, 2012).

These 2 alterations we must make are all located in the same file under the All-In-One SEO plugin. The file is aioseoclass.php. Here is the outline of the changes we will make:

  1. Check current URL to see if it is paginated
  2. If so, set current page number in a variable
  3. Add page number to page title tag
  4. Add page number to meta description


Desciption

Line 322. This puts “Page x of series” before the description to make it unique.

/* BEFORE: $meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description); */
$exploded = explode("/",$_SERVER['REQUEST_URI']);
if( is_numeric( $exploded[sizeof($exploded)-2] ) ){
    $description = "Page ".$exploded[sizeof($exploded)-2]." of series - ".$description;
}

Canonical URL

Near line 383. This matches the canonical url with the current paginated URL.

NO LONGER USED
/* goes after: $url = apply_filters('aioseop_canonical_url',$url);
$exploded = explode("/",$_SERVER['REQUEST_URI']);
if( is_numeric( $exploded[sizeof($exploded)-2] ) ){
    $url = $url.$exploded[sizeof($exploded)-2]."/";
} */

Page title

Line 722. This changes the <title> tag.

/* BEFORE: $title_format = $aioseop_options['aiosp_post_title_format']; */
$exploded = explode("/",$_SERVER['REQUEST_URI']);
if( is_numeric( $exploded[sizeof($exploded)-2] ) ){
    $title = $title." (Page ".$exploded[sizeof($exploded)-2].")";
}

After placing these 2 code snippets into the plugin’s php file, simply give Google a day or two and your additional pages will begin to show up in search results. You can look at the page source output to verify this has worked.

If this tip helped you, or if you want to contribute, leave a comment!