Though SEO doesn’t get me all hot and bothered like it does some people, it is on my radar, as I think it should be for all web designers and developers.
One of the blogs I’ve recently subscribed to is SEOMoz, which I like both because it seems to be run by real professionals and thus avoids a lot of the sketchier, black/gray hattish SEO techniques, and also because it seems to have fairly good user comment discussions.
I was particularly interested by a recent “Whiteboard Friday” post in which SEOMoz CEO and co-founder Rand Fishkin discusses an SEO issue with pagination that had arisen with a client. While the blog post title, “A Farewell to Pagination” may be going a bit overboard, there were some definite good points, which basically revolved around the notion that extended pagination in which a website may have hundreds of pages going back years that are all organized in reverse chronological (or some other order) and accessed via pagination can be bad not just for navigation, but also for SEO.
Diving deeper and deeper into the site this way successively dilutes your link juice for the search engines that are crawling your site, potentially leading them to abandon including the deeper/older pages in their index, leading to their exclusion from search results. Fishkin discusses some navigation workarounds that are improvements both from an SEO and user experience point of view.
Applying this to Wordpress, I wondered if there was a Wordpress filter hook that would allow you to create a simple plugin that could appropriately add the rel="nofollow" attribute to your pagination anchor tags, so that pagination is still available to the user but won’t have the deleterious SEO effects. Turns out there isn’t, but there’s another easy, though less elegant, way to accomplish this, which is by defining a function in your Wordpress templates’ functions.php file.
Just copy and paste the previous_posts_link and next_posts_link functions from wp-includes/link-template.php into your functions.php file, and make the following simple modification
function nofollow_next_posts_link($label='Next Page »', $max_page=0) {
global $paged, $wp_query;
if ( !$max_page ) {
$max_page = $wp_query->max_num_pages;
}
if ( !$paged )
$paged = 1;
$nextpage = intval($paged) + 1;
if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) {
echo '<a rel="nofollow" href="';
next_posts($max_page);
echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
}
}
function nofollow_previous_posts_link($label='« Previous Page') {
global $paged;
if ( (!is_single()) && ($paged > 1) ) {
echo '<a rel="nofollow" href="';
previous_posts();
echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>';
}
}
With that done, simply use the new functions wherever in your template you want the nofollow functionality (e.g. in index.php). This is really only the beginning of a solution to this issue, as you’ll have to rework other aspects of your navigation if you really want to add rel="nofollow" to all your Wordpress pagination.





5 Comments
Wordpress is a great blogging platform and getting it search engine optimized really isn’t a hard task. Using proper permalinks and robots.txt file to prevent duplicate content and a few other methods can really make a difference. The All in One SEO plugin is really the best bet.
Thanks, I’ll check it out.
Right now this bog is not really at all optimized for SEO. I’m using a Dublin Core plugin and no meta keywords or description… should probably take care of that soon!
Good informations,thanks.
Wordpress is quite a good Blog Software … and your theme really looks nice – go gon with that
Great post. Thanks for sharing!
I also have something about SEO to share. Check out at my website please.51
One Trackback
[...] Better pagination SEO with Wordpress everything flows Posted by root 7 minutes ago (http://www.lukerodgers.ca) Wordpress 39 comment form tabindex no noedit the tabindex values in your craftmanship in the age of industry middot wordpress 39 comment form tabindex no no everything flows is powered by wordpress and based on the sandbox theme Discuss | Bury | News | Better pagination SEO with Wordpress everything flows [...]