views:

38

answers:

2

I have this script in the head of all my pages- which in an include:

    <?php
  if (isset($robots) && $robots == "off") {
      $robots = '<meta name="robots" content="noindex,nofollow">';
      print $robots."\n";
  } else {
      $robots = '<meta name="robots" content="index,follow">';
      print $robots."\n";
  }
?>

After the head is loaded the rest of the page loads and a variable is set.

$robots="off"; or $robots="";

I cannot get a single page to index in google. I am wondering if this is actually broken and all pages are being set to noindex, nofollow. If i view the source everything looks fine. eg pages I want indexing have index, follow and pages i dont want have noindex, nofollow.

Can anyone help?

A: 

If you're 100% sure that your code is in order, sign up your site at Google Webmaster Central to get real-time data about how Google crawls your site, and possible errors.

If Google is just not dropping by to crawl your site, consider submitting a XML sitemap - it sometimes seems to me this makes the next crawl happen sooner. (I have no hard data on that, though.)

Pekka
Thanks, it was the first thing I did and no luck
AJFMEDIA
@AJFMEDIA But Webmaster Central should give you an exact overview on what was crawled, what wasn't, and why.
Pekka
Cheers it does, but basically. I had an old version of the site with horrible urls so instead of doing masses of url rewriting I just asked google to remove my whole site. I then rebuilt the site with a better architecture and resubmitted the site to google.The real time crawl errors just says iv got x amount of missing pages, but they are the urls of the old site that doesnt exist anymore. Its like im still in googles cache as the old site. and those pages arnt linked to from aywhere. it actuall says i have 46 pages indexed but i really havnt
AJFMEDIA
@AJF ah, okay. Strange. Google should definitely be picking up the change at some point. I still think submitting a sitemap is the best way to go
Pekka
Yeah got both an xml and html sitemap. I think I need to redirect all the crawl errors to a relevant page on the site. If i start to index ill let you know, Thanks again
AJFMEDIA
+2  A: 

Look at Google's Webmaster Blog for that particular subject - you should omit the meta tag when your $robots variable contains "on".

Furthermore, using the blog and webmaster central would be a smarter and more efficient way to actually determine if your site is indexed and help improving your understanding in SEO.

Repox
I should omit my meta tag when it contains on? I thought my way would have been the logical solution. As since google defaults to indexing all pages, surely saying "dont index this page" with robots="off" is better than saying index this page, index that page.
AJFMEDIA
I made an assumption of your variable content - when you $robots variable is set and contains "off" you wish to deny robots access. I assumed that $robots would contain "on" otherwise and therefore the whole metadata tag - as stated in the blogpost - is irrelevant.
Repox