Eliminating duplicate WordPress content in Google
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]
if (is_home() || is_single())
{
echo ““;
}
else
{
echo ““;
}
[/php]
Brian – I don’t understand how to use this. What an I missing?
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
@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.
Ah cool, sorry about that
John – I’m glad you said something – I hadn’t noticed the update to the post until your comment. Thanks.
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…
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?
Yes it should, did you have any caching installed on those pages?
No Brian – no caching was being used.
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
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
I think I saw a plugin that will do this, am I right?
Very nice theme congrats.
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?
Very useful information. Thanks!!
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!
Thanks nice blog regards!
wow thats great.. i appreciate it 🙂 Thank You
Very interesting that Matt cares about WP bloggers and wants to help them gain better rankings in SE.
Thanks
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
Very useful information for me. Thank you.
Is there any plugins that do this? lol. I am not good at codes.