SEO for WordPress Pagination (Multiple Page Pages / Posts)
Introduction: Out of the box, support for SEO (search engine optimization) of WordPress is poor. With the help of WordPress SEO like Yoast WordPress SEO, the WordPress website can be configured to behave in a search engine friendly way. However, custom tweaking is required for WordPress pagination in order to avoid duplicate titles and meta descriptions.
Article Highlights
How to create WordPress pagination (multiple page post / page )
For very long posts or pages, it is very easy to split the long text into multiple pages using the tag <!–nextpage–> which must be added in the “text” editor.
The pager should be shown right away if configured correctly (the pager is the “Pages: 1 2 3 4 5…” element in the screen capture below).
If you cannot find the pager, you should look into your template file (most likely the single.php) and add the following line of code just after the <?php the_content(); ?>. You can edit the code within the admin interface: Appearance > editor and select single.php, post.php, page.php or any custom templates.
<?php wp_link_pages(); ?>
SEO Implications for WordPress Pagination
However, as said, the multiple page posts or pages created this are not search engine friendly owing to the following reasons:
- the different pages are considered as separate items by the search engine and thus diluting the content values of the post/page (i.e. less occurrence of keywords, thin contents, etc.)
- the titles and meta descriptions for all the pages are identical which will give rise to the duplicate titles and meta descriptions issue. You will get the duplicate titles and meta descriptions error in the HTML Improvements section of the Google Webmaster Tool or Bing Webmaster Tool.
Add Filters in WordPress to Change the Titles and Descriptions to Avoid Duplication with WordPress Pagination
If you do not use any SEO Plugins for WordPress, you might just add the following line of code to the functions.php file located in the theme folder (wp-content/themes/[yourthemename]). It is often advised to change the files in the child theme lest the updates to your theme will overwrite the changes made by you. But for convenience of explanation, just add the following lines of code to the end of functions.php:
/** Add Page Number to Title and Meta Description for SEO **/
if ( ! function_exists( 'multipage_metadesc' ) ){
function multipage_metadesc( $s ){
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 < $page && $paged = $page;
$paged > 1 && $s .= ' - ' . sprintf( __( 'Part %s' ), $paged );
return $s;
}
add_filter( 'metadesc', 'multipage_metadesc', 100, 1 );
}
if ( ! function_exists( 'multipage_title' ) ){
function multipage_title( $title ){
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 < $page && $paged = $page;
$paged > 1 && $title .= ' - ' . sprintf( __( 'Part %s' ), $paged );
return $title;
}
add_filter( 'title', 'multipage_title', 100, 1 );
}
The multiple paged posts and pages will now show “[Title] – Part 1” and so on for different pages of the post/page. You might like to change the text bolded in the above code (i.e. ” – ” and “Part ” above to change it) to read different. E.g. Change “Part” to “Page”. Below is the result of such implementation:
For Yoast WordPress SEO Plugin
Change ‘metadesc’ and ‘title’ to ‘wpseo_metadesc’ and ‘wpseo_title’ respectively if you are using Yoast WordPress SEO Plugin as follows:
/** Add Page Number to Title and Meta Description for SEO **/
if ( ! function_exists( 'multipage_metadesc' ) ){
function multipage_metadesc( $s ){
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 < $page && $paged = $page;
$paged > 1 && $s .= ' - ' . sprintf( __( 'Part %s' ), $paged );
return $s;
}
add_filter( 'wpseo_metadesc', 'multipage_metadesc', 100, 1 );
}
if ( ! function_exists( 'multipage_title' ) ){
function multipage_title( $title ){
global $page;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
! empty ( $page ) && 1 < $page && $paged = $page;
$paged > 1 && $title .= ' - ' . sprintf( __( 'Part %s' ), $paged );
return $title;
}
add_filter( 'wpseo_title', 'multipage_title', 100, 1 );
}
Conclusion
However, owing to the difference in implementation of SEO plugins, the above solution may or may not work as expected. In such circumstances, a complete code inspection might be needed to change the title and meta descriptions to avoid duplications for Wordpress pagination (multiple page post / page).
Very intresting post. It can be usefull, but it is still working? Greetings.
Oh, I haven’t checked this. Perhaps some visitors may tell us? Thanks!
I have used above two methods. but both two methods not working for me. i have copy the code and paste it in fuction.php in child theme. Please let me know how to fix the issue.
Thanks in Advance
Maybe the code is a bit outdated, you may need to make some adjustments. Thanks!
Thanks Its such a very nice solutions for Yoast Seo Plugins meta title for paginated pages.
Glad that you find it useful!
Thank you, will try this later.
Thanks, helped me a lot!! 🙂
Great! It’s still works for Yoast even now in december 2016
It works for my website (under my nick) thanks a lot 🙂
I using this code for yoast & works! btw, is possible this code make homepage slow load by any chances?
Sometimes my blog just not response in homepage.. or maybe it’s just my hosting problem.. i don’t really know..
Hey, Thank You so much for this tutorial.
Fantastic – I couldn’t solve problem with my titles of pagination pages until I read this article. Awesome work!
Thanks a lot 🙂
It solved the problem entirely. No more duplicate titles & descriptions.
Thank you, this is SOLVED 100% 🙂
Thank you so much. It solved my issue 🙂