Internet
How to
Newspapers
Twitter
SEO advice
Categories: How to, Wordpress. Tags: , , ,

Can you use rel = canonical to fix duplicate comment problems caused by comment pagination in wordpress?

February 15, 2009 3 Comments

If you turn on comment pagination in wordpress, you get duplicate content problems.

This means a posts' comments are split across several pages and URLs - the post at the top is the same on each URL but the comments are different. There is also a URL version - the /comment-page-1/ one - that is identical to the permalink. This is a problem even if you don't have enough comments for pagination to kick in.

This means you'll end up with people linking to different 'versions' of the post, diluting the SEO benefit of those links.

Rel = canonical

The major search engines have agreed a new tag - rel=canonical - so that you can tell them, if you have the same content across several URLs on your site, which is the 'real' one. They'll treat the different versions as if they were the real one - including the benefit of all the links to the other URLs.

It's designed to help sites whose URLs contain session IDs or, say, sort orders for tabular information. But can you use it to fix the problem of the same post with several URLs, each with different comments on?

Code to use rel=canonical

This is the code you'd add to your head section to make rel=canonical appear:

<?php if (is_single()) {
echo '<link rel="canonical" href="';
echo get_permalink();
echo '">';
} ?>

I'm sure with my customary inelegant PHP, this can be optimised.

Anyway, what do you think? Is this the solution to duplicate content caused by comment pagination?

Obviously, this case is slightly different to the use intended for rel=canonical, as the content isn't identical (as the comments are different) - apart from the /comment-page-1/ version, where it is identical.

More reading about comment pagination and duplicate content in wordpress

Try these sites:

More reading about rel = canonical

Try these sites:

You might also like
  1. WordPress comment pagination & duplicate content
  2. Avoid duplicate content with paged comments in wordpress
  3. Adding page numbers: How to avoid duplicate titles and meta descriptions in pages 2 and higher of WordPress category and tag pages
  4. Cross-domain rel=canonical now supported by Google
  5. 29 easy ways to fine tune your blog

Share this post

Follow me on Facebook or Twitter

3 Comments »

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.