Difference between revisions of "Verify Website Ownership for Google with a Meta Tag"

From Joomla! Documentation

m (Fix syntax error and add highlighting)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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 [https://support.google.com/webmasters/answer/35179?hl=en "Verify" your Joomla! website with Google] but these instructions use the HTML Meta tag method.
+
<noinclude><languages /></noinclude>
 +
<translate><!--T:1-->
 +
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 [https://support.google.com/webmasters/answer/35179?hl=en "Verify" your Joomla! website with Google] but these instructions use the HTML Meta tag method.</translate>
  
== Gathering Information ==
+
<translate>== Gathering Information == <!--T:2--></translate>
  
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.  
+
<translate><!--T:3-->
 +
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.</translate>
  
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.
+
<translate><!--T:4-->
 +
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.</translate>
  
== How To ==  
+
<translate>== How To == <!--T:5--></translate>
  
 +
<translate><!--T:6-->
 
# 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.
 
# 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.
 
# Locate the template's <tt>index.php</tt> 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.  
 
# Locate the template's <tt>index.php</tt> 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.  
Line 16: Line 21:
 
## Select HTML tag and copy the code.
 
## Select HTML tag and copy the code.
 
# Insert the HTML meta tag in the Header section before the body tag.  
 
# Insert the HTML meta tag in the Header section before the body tag.  
# Go back to the Webmaster Search console and click on ''Verify''.
+
# Go back to the Webmaster Search console and click on ''Verify''.</translate>
  
== Example of Code ==
+
<translate>== Code Placement Example == <!--T:7--></translate>
  
The following is an example of where to place the code in the Protostar template. The <tt>index.php</tt> file is a mix of php and html. You will need to find the <tt><!DOCTYPE html></tt> or the <tt><html&gt;</tt> tag followed by the <tt><head></tt> tag.
+
<translate><!--T:8-->
 +
The following is an example of where to place the code in the "Protostar" template. The <tt>index.php</tt> file is a mix of php and html. You will need to find the <tt><!DOCTYPE html></tt> or the <tt><html&gt;</tt> tag followed by the <tt><head></tt> tag in the php file's code.</translate>
  
 
<syntaxhighlight lang="php" highlight="5,6,7,8">
 
<syntaxhighlight lang="php" highlight="5,6,7,8">
Line 43: Line 49:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Now insert the meta tag for Google verification.
+
<translate><!--T:9-->
 +
Now insert the meta tag for Google verification.</translate>
  
<syntaxhighlight highlight="4">
+
<syntaxhighlight lang="php" highlight="4">
 
<!DOCTYPE html>
 
<!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; ?>">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
Line 54: Line 61:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Errors ==
+
<translate>== Errors == <!--T:10--></translate>
  
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 [https://support.google.com/webmasters/answer/35638#3 Meta tag verification errors] section on Google support page for additional help.
+
<translate><!--T:11-->
 +
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 [https://support.google.com/webmasters/answer/35638#3 Meta tag verification errors] section on Google support page for additional help.</translate>
 +
 
 +
<noinclude>
 +
<translate>
 +
<!--T:12-->
 +
[[Category:Search Engine Optimisation]]
 +
[[Category:Tutorials]]
 +
</translate>
 +
</noinclude>

Latest revision as of 09:27, 27 May 2019

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

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[edit]

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[edit]

  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[edit]

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[edit]

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.