WordPress subpages going supplemental: the fix

April 18th, 2007 – 31 Comments

I noticed that the subpages for my blog (you can find links to them in the footer of this page), were all going supplemental. This wasn’t really surprising as those subpages were displaying exactly the same as the frontpage: 5 full posts and a “next” and “previous” link to the next pages. This meant that page 32 was a full 32 clicks away from the blog frontpage…

Looking around if other people had the same problem, I noticed that Jaimie didn’t… He had posted about these issues a while ago:

  1. Stop SEO Death By Pagination
  2. 3 WordPress Hacks For SE-Friendly Blog Archives

Basically I did a few things:

  1. I changed the title and breadcrumbs on subpages.
  2. I made the subpages display excerpts (the first 300 words) instead of the full post.
  3. I changed the pagination using Jaimie’s pagerfix plugin which he was kind enough to update for WordPress 2.1.

1. Changing the title tag and breadcrumbs.

I used the following code in header.php to make sure the title reflects the page you’re on:

if (is_home() ) {
	if (get_query_var('paged') > 1) {
		echo ' - Page ' . get_query_var('paged');

Of course you can adjust your template to make the title display right for you.
In my index.php I added the following for the breadcrumbs:

<div id="breadcrumbs"> <a href="/">Home</a>
< ?php
	if (is_home() && get_query_var('paged') > 1) {
		echo '/ <a href="https://yoast.com/">SEO Blog</a> / ';
		echo 'Page ' . get_query_var('paged');
	} else {
		echo ' / SEO Blog ';

2. Changing the subpages to display excerpts

I added the following into the loop for posts to make them display excerpts on the subpages:

< ?php if (is_home() && (!$paged || $paged == 1) || is_search()
 || is_single() || is_page()) {
	the_content('Read the rest of this entry »');
} else {
  Archived; click post title to view the full post.<br />
  <br />
  <strong>Excerpt:</strong> < ?= substr(strip_tags($post->post_content), 0, 300); ?>
  <a href="<?php the_permalink() ?>">…</a>;
< ?php } ?>

I’ve done this for my archive pages as well, as I want my post pages to rank higher.

3. Changing the pagination

The last thing I did was installing Jaimie’s pagerfix plugin, and calling it in the template with the following code:

pager_fix(" "," "," ","« Previous page","Next Page »","strong");

Jaimie covers a lot of this in his book on PHP and SEO, which you should definitly go get if you’re doing a lot of this stuff!

31 Responses to WordPress subpages going supplemental: the fix

  1. Neil
    By Neil on 14 February, 2008

    Does anyone know how to list sub-pages in a multi-column, I mean I dont want to spend the time learning the api of wordpress when I just need a simple multi-column sub-page list.

  2. Joost de Valk
    By Joost de Valk on 16 January, 2008

    @Daniel hmm I’d not display them at all… If you pass me the plugin at joost at this domain, I could easily hack that in for you.

  3. Daniel
    By Daniel on 16 January, 2008

    @Joost, Thanks for the speedy reply.

    What if the solution is to leave the metatags for paged index pages blank?

  4. Joost de Valk
    By Joost de Valk on 16 January, 2008

    @Daniel: sharing meta descriptions is almost never a good idea, so I guess this would be a smart solution :).

  5. Daniel
    By Daniel on 16 January, 2008

    Hi Joost,
    I’ve been trying to do some SEO housecleaning on my site and implemented Lester’s pagination plugin and an SEO plugin for meta keywords and meta descriptions.

    The plugin that I chose for metatag generation is implemented in a way that deliberately does not generate meta keywords or meta descriptions for paged index pages (2…15).

    Any thoughts on whether paged index pages (so long as they contain excerpts and not full text of posts) should share meta keywords and meta descriptions with the index page?

  6. Medical Transcriptionist
    By Medical Transcriptionist on 28 November, 2007

    Thanx Ruud Kok, I was in search of this meta tag.

  7. Joost de Valk
    By Joost de Valk on 15 June, 2007

    Good stuff TechDuke :) thx!

  8. TechDuke
    By TechDuke on 15 June, 2007

    For some reason, I couldn’t run this plugin on my site. It was giving some sort of MySQL error.
    After doing some search, I found this plugin http://www.lesterchan.net/wordpress/readme/wp-pagenavi.html , and it works perfectly fine. For those having problems with this method can use the plugin I mentioned.

  9. Astrit
    By Astrit on 16 May, 2007

    Yeah figured it now. Thank you Joost, this was exactly what i was looking for. :)

    Enjoint Netherland (or rather Amsterdam)

  10. Joost de Valk
    By Joost de Valk on 15 May, 2007

    Hey Astrit: within the loop, which is the function which displays the post.

  11. Astrit
    By Astrit on 15 May, 2007

    Apologies, that is just half of code, what i had pasted (but did not displaied for some reason) was your full code for 2. Changing the subpages to display excerpts

  12. Astrit
    By Astrit on 15 May, 2007

    Hello Joost,
    Could you please explain where this code exactly should be put (not very friendly with technical words such as loop etc)

    Archived; click post title to view the full post.

    Excerpt: post_content), 0, 300); ?>

    I liked your idea and thought this would be the best solution for preventing duplicated content being indexed in Google. I just can’t figure where that code should be placed.

    Thank you.

  13. rxbbx
    By rxbbx on 22 April, 2007

    better then blocking everything.. you guys are right. why focus on one solution when you can have it all..

  14. Ruud Kok
    By Ruud Kok on 21 April, 2007

    In my bookmarks I found this thread on WMW: http://www.webmasterworld.com/google/3097706.htm

  15. Joost de Valk
    By Joost de Valk on 19 April, 2007

    Hmm better than blocking them alltogether, but still you’re blocking all subpages… I like my resolution more ;)

  16. Ruud Kok
    By Ruud Kok on 19 April, 2007

    I’m using the following code to avoid duplicate content to be indexed but
    still remain search engines to follow link structures:

    <?php if (is_home() && ($paged <= "1") || is_single() || is_page() || 
    is_category() ) {
    	echo '<meta name="robots" content="index,follow" />';
    	echo '<meta name="robots" content="noindex,follow" />';
  17. Joost de Valk
    By Joost de Valk on 19 April, 2007

    Another advantage of this solution is that spiders will actually properly index your internal linking structure, which is lost if you block it from them…

  18. SEO Egghead
    By SEO Egghead on 19 April, 2007

    I’m on Joost’s side, obviously ;) I updated PagerFix for WP 2.1 when Joost mentioned he wanted to make the changes I blogged about awhile back.

    I highly recommend everyone make these changes to WP. It doesn’t sacrifice usability, while reducing duplicate content substantially.


  19. Joost de Valk
    By Joost de Valk on 18 April, 2007

    The advantage of this solution in my opinion is that it actually means “different” content will be indexed, allowing for other keyword matches. I actually see quite a bit of traffic coming to my category pages coming because of matching of two different keywords in two separate posts.

  20. Rxbbx
    By Rxbbx on 18 April, 2007

    I also restrict urls with robots.txt. This looks good too.

  21. TruFu
    By TruFu on 18 April, 2007

    Hmm, interesting. I had a different look at this problem. What I did is restricting URLs where duplicate content was situated. On WP blogs, that is /category/, /feed/ and /page/ (I use full feeds, no excerpts). It seems te be working, my supplementals did decreases. This way, all the focus is on the individual pages.

    A few pages still hit supplemental, but a internal link to that post does the magic.

    I guess there are more roads that lead to Rome.

  22. Joost de Valk
    By Joost de Valk on 18 April, 2007
  23. André Scholten
    By André Scholten on 18 April, 2007

    I noticed it some months ago and used exact the same solution. It works fine right now.

  24. monchito
    By monchito on 18 April, 2007

    nice :) will definately use this when i convert to wp :p

Check out our must read articles about Analytics