Eliminating duplicate WordPress content in Google

Ξ November 7th, 2007 | → | ∇ WordPress, b5media |

If you are at WordCamp 2007, one of the best sessions was Google’s own Matt Cutts discussion on optimizing your WordPress blog. You can see the whole presentation over on John Pozadzides site’s One Man’s Blog. Here is the link. You can see in Matt’s Whitehat SEO tips for bloggers slide show that one of the things that WordPress “suffers from” is that you can reach the same data from multiple sources.

You can get to the same article by browsing by category, by day, month, year etc. etc. etc. Each time Google sees the same data repeated on your site again, it hurts your site a little bit more.

This bit of code will help fix it. It goes into the header part of your blog and will tell Google that it should ignore all of the pages that are not the orginal source of the article.

Here you go:

PHP:
  1. if (is_home() || is_single())
  2.   {
  3.     echo “<meta name=\”robots\” content=\”index,follow\”>”;
  4.   }
  5. else
  6.   {
  7.     echo “<meta name=\”robots\” content=\”noindex,follow\”>”;
  8.   }

 

22 Responses to ' Eliminating duplicate WordPress content in Google '

Subscribe to comments with RSS or TrackBack to ' Eliminating duplicate WordPress content in Google '.

  1. Kevin said,

    on November 7th, 2007 at 10:27 pm

    Brian - I don't understand how to use this. What an I missing?

  2. John Motson said,

    on November 21st, 2007 at 10:44 am

    Great post Brian. I will definitely plug it into my blog.

    @Kevin - basically what the code does is tell the visiting google bots to only consider and index the actual post. If the bot found this post via the categories link or any other way through your blog, then you are kindly asking the google bot to not index it and hence hurt your ranking.

    Just plug it into your header.php

  3. Kevin said,

    on November 21st, 2007 at 12:18 pm

    @John - thanks for the input. What I was missing was how to format the code and it looks like Brian updated the post with that since my comment. Now I should be able to get it to work.

  4. John Motson said,

    on November 21st, 2007 at 1:30 pm

    Ah cool, sorry about that

  5. Kevin said,

    on November 21st, 2007 at 1:58 pm

    John - I'm glad you said something - I hadn't noticed the update to the post until your comment. Thanks.

  6. Brian said,

    on November 21st, 2007 at 2:58 pm

    Sorry Kevin, I'd typed up a comment just so that you would be notified. I even went out to visit your site after I typed it up. I must have gotten so caught up in one of your posts that I forgot to hit "post comment" back here... Anyway, glad it makes sense now...

  7. Kevin said,

    on November 21st, 2007 at 3:10 pm

    No problem Brian - I thought it was a little strange you hadn't replied to my comment but forgot about it and didn't come back to the post.

    I've tried it temporarily on one of my sites and I'm not seeing any of the page headers show "noindex" only "index". Shouldn't it be showing the "noindex" on the category, month and years pages, etc.? Or am I not understanding how it works?

  8. Brian said,

    on November 30th, 2007 at 4:03 pm

    Yes it should, did you have any caching installed on those pages?

  9. Kevin said,

    on November 30th, 2007 at 4:15 pm

    No Brian - no caching was being used.

  10. shane said,

    on December 30th, 2007 at 6:17 pm

    Hey Brian great tip.
    Ok maybe I'm just a dummy ( actually thats a foregone conclusion) But when I put that in my header.php I keep getting a parse error. I dont expect support but Could you , when you have the time maybe clarify where in the header, ive looked at how some of the php code is formatted and tried to duplicate to no avail
    Cheers and Beers
    Shane


  11. on February 8th, 2008 at 6:33 am

    I have been visiting this site a lot lately, so i thought it is a good idea to show my appreciation with a comment.

    Thanks,
    Jim Mirkalami


  12. on May 24th, 2008 at 12:03 pm

    I think I saw a plugin that will do this, am I right?

  13. Oliver said,

    on June 6th, 2008 at 3:55 am

    Very nice theme congrats.

  14. Jason said,

    on June 30th, 2008 at 2:30 pm

    I keep getting an error when I insert it into the header file. The php is formatted correctly so I don't get it. Is there any specific place it needs to be inserted?

  15. Max said,

    on July 1st, 2008 at 7:16 am

    Very useful information. Thanks!!

  16. Brian said,

    on July 1st, 2008 at 9:30 am

    There are two things that could cause problems.
    First is that I said is_singlar instead of is_single()

    The second is that the quotes used might are being changed to the fancy directional quotes in some browsers. So, copy what is listed above and paste into your code anywhere you have a meta line in header.php. Then change the quotes from the fancy directional double quotes to the normal double quotes. That should get you going!

  17. SEO Algarve said,

    on July 16th, 2008 at 5:20 pm

    Thanks nice blog regards!

  18. Niyaz said,

    on July 22nd, 2008 at 3:04 am

    wow thats great.. i appreciate it :) Thank You

  19. psp games said,

    on July 22nd, 2008 at 4:41 pm

    Very interesting that Matt cares about WP bloggers and wants to help them gain better rankings in SE.

    Thanks

  20. GamingMonk said,

    on July 25th, 2008 at 2:38 am

    Well Yeah its nice to prevent from google penalty and rest of stuff.. because duplicate content is harmful... Well its good now... Thanks for the Information

  21. Maria said,

    on August 5th, 2008 at 7:12 am

    Very useful information for me. Thank you.


  22. on September 2nd, 2008 at 4:13 am

    Is there any plugins that do this? lol. I am not good at codes.

Leave a reply