Welcome to my blog, please feel free to subscribe to my RSS feed, join me on Twitter or leave a comment.
There are a lot of blogs you’ll find with an invaluable code snippet designed to ensure Google only indexes the posts on your website and does not duplicate the categories and tags pages, unfortunately the code they’re using has a critical flaw as you’ll see by viewing my Google Webmasters Tool report to the right. Even using the tool, I keep getting duplicate content notifications.
The code is here:
<?php if(is_home() || is_single() || is_page()){
echo ‘<meta name=”robots” content=”index,follow”>’;
} else {
echo ‘<meta name=”robots” content=”noindex,follow”>’;
}?>
You can find it on a ton of blogs:
- http://www.thisismyurl.com/wordpress/meta-tags-that-kill-your-blog/ and;
- http://www.thisismyurl.com/web-advice/meta-tags-that-kill-your-blog/
if(is_home()) {echo ‘<meta name=”robots” content=”index,follow” />’; }elseif(is_page()) {echo ‘<meta name=”robots” content=”index,follow” />’; }elseif(is_single()) {} else { echo ‘<meta name=”robots” content=”noindex,follow” />’; }
$category = get_the_category();if(strpos($_SERVER['REQUEST_URI'],$category[0]->category_nicename.”/”)>0) {echo ‘<meta name=”robots” content=”index,follow” />’;} else {echo ‘<meta name=”robots” content=”noindex,follow” />’;}
if(is_home()) {echo ‘<meta name=”robots” content=”index,follow” />’; }elseif(is_page()) {echo ‘<meta name=”robots” content=”index,follow” />’; }elseif(is_single()) {$category = get_the_category();if(strpos($_SERVER['REQUEST_URI'],$category[0]->category_nicename.”/”)>0) {echo ‘<meta name=”robots” content=”index,follow” />’;} else {echo ‘<meta name=”robots” content=”noindex,follow” />’;}} else { echo ‘<meta name=”robots” content=”noindex,follow” />’; }






Internet Marketing Do-Follow Blog on October 26, 2008 at 3:56 am
Isn’t restricting crawls for tags and categories in a robots.txt file not enough? I have the first code you mention in my theme and I also have the robots file.
malcolm coles on February 11, 2009 at 7:29 pm
Wouldn’t it be simpler to leave the category out of your permalink? That way you’d have the post on just one URL, regardless of how many categories you had it in?
malcolm coles’s last blog post..SEO friendly URLs: myth and fact