How to
SEO advice
Categories: How to, Wordpress. Tags: ,

Avoid duplicate content with paged comments in wordpress

January 17, 2009 5 Comments

I've written before about the problem of duplicate content problems with wordpress comment pagination.

After reading this post about using the excerpt on pages 2 or higher of the comment loop, I discovered the variable that will give a similar solution to that for duplicate content in pages 2 or higher of the wordpress loop.

So use the PHP below, and you won't have duplicate content problems if you have paginated comments. Update: And see Christian's comment at the end to see it not only in action, but how he's edited All in One SEO Pack to get it to work with that as well. Blimey!

Use cpage instead of paged

To avoid duplicate content problems, you need a different title and a different meta description. The easiest way to do this is to add 'Page X' into the title and meta description of the blog post.

Here's the code to do this - add it into your theme's header just before the closing </title> tag:

<?php if ( $cpage < 2 ) {}
else { echo (' - comment page '); echo ($cpage);}

Do something similar with the code that generates your meta description.

What the code does

If you're on page two or higher of paginated comments, it adds ' - comment page X' (where X is the comment page) to the end of the title (which is the heading that appears in google).

You can use something similar in your meta description code.

Where can I see it working?

It was working here when I tried it. As the most comments I have on a post is 19 so far,  however, I don't actually paginate my comments yet (it's set to the default of 50 - I changed it to 2 to test it, but i couldn't really leave it like that!!)

Perhaps someone with a lot of comments could use it and provide a link so we can see it working ... Update: See Christian's comment for someone who has done just that.

You might also like
  1. Adding page numbers: How to avoid duplicate titles and meta descriptions in pages 2 and higher of WordPress category and tag pages
  2. WordPress comment pagination & duplicate content
  3. Can you use rel = canonical to fix duplicate comment problems caused by comment pagination in wordpress?
  4. Unique meta description and meta keyword tags in your WordPress themes
  5. Ignore WordPress’s SEO advice

Share this post

Follow me on Facebook or Twitter


Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.