Verify Website Ownership for Google with a Meta Tag

From Joomla! Documentation

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎Nederlands

Verifying your website tells Google that you own your website. It provides a secure channel between your website and Google to exchange information. There are a number of ways to "Verify" your Joomla! website with Google but these instructions use the HTML Meta tag method.

Gathering Information

You will need to get some information about the template you are using. If you are using a purchased template created by a third party template developer, you might have to contact the template developer to receive instructions on how to insert the meta tag into the template. Follow the steps below to generate the tag you need and then follow your template developers instructions to insert the code.

If you are using the "Protostar" template or have developed your own template follow these steps. Note these steps are for the Default template. If you are using more than one template assigned to different items, you will have to insert your meta tag into each template.

How To

  1. In the Administrator, go to the Template Manager. If you don't see Template Manager on the Control Panel or in the Extensions dropdown, you might not have the proper permissions.
  2. Locate the template's index.php file by clicking on the name of the template in the Template column or selecting the Template view in the right column and selecting Details and Files link.
  3. Go to Google Search Console Home Page and retrieve your HTML Meta tag code.
    1. click the Manage Site button next to the site you want, and then click Verify this site.
    2. If HTML tag is not visible on the Recommended method tab, click the Alternate methods tab.
    3. Select HTML tag and copy the code.
  4. Insert the HTML meta tag in the Header section before the body tag.
  5. Go back to the Webmaster Search console and click on Verify.

Code Placement Example

The following is an example of where to place the code in the "Protostar" template. The index.php file is a mix of php and html. You will need to find the <!DOCTYPE html> or the <html> tag followed by the <head> tag in the php file's code.

{
	$logo = '<span class="site-title" title="' . $sitename . '">' . $sitename . '</span>';
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<jdoc:include type="head" />
	<?php // Use of Google Font ?>
	<?php if ($this->params->get('googleFont')) : ?>
		<link href='//fonts.googleapis.com/css?family=<?php echo $this->params->get('googleFontName'); ?>' rel='stylesheet' type='text/css' />
		<style type="text/css">
			h1,h2,h3,h4,h5,h6,.site-title{
				font-family: '<?php echo str_replace('+', ' ', $this->params->get('googleFontName')); ?>', sans-serif;
			}
		</style>
	<?php endif; ?>

Now insert the meta tag for Google verification.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
	<meta name="google-site-verification" content="String_we_ask_for" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<jdoc:include type="head" />

Errors

Google will verify that the meta tag exists in the correct location. If Google can't find the tag, they will give you information about the error. Please read the Meta tag verification errors section on Google support page for additional help.