Login

Getting Google Site Verification Working

While the Nodewords module contains a Google Site Verification field to enter the verification id, the version I was using was not adding a metatag that was recognized by Google.  The problem seemed to lie in the tag name.  Nodewords uses name=verify-v1.  And so do some other Google verification tags.  But, according to the Webmaster Tools for my particular site, it should be name=google-site-verification

I poked around through the module and database to see if I could reset it, but I decided it would be more prudent to just add the tag itself.  In that the metatag is only suppose to show up on the front page and in the <HEAD> tag, I opted to add it to the $head variable. 

I got my verification metatag via Google Webmaster Tools and added it in the phptemplate_preproccessing_page function in the template.php file. 

The code looks like this:

if ($vars['is_front']){
    $vars['head'] .= '<meta name="google-site-verification" content="google site verification id" />' ;
  }

First, I check to see if we're processing the front page.  If so, then add the tag to the $head variable that gets rendered on the page.

If you try and cut and paste this, keep in mind that $vars is the name in my function.  Yours may be different.

Post new comment

Leave a comment