The meta tags belong in the part of the page called the head element. In order to use them, you need to know what they can do and how they are created.
What Is a <meta> Tag?
A <meta> tag is an element in HTML that provides meta-data about a page, primarily for search engines. The tags always appear inside the head element. The categories of items that you can put in <meta> tags are called attributes, and there are only four of them defined in HTML 4:
- content—mandatory in all <meta> tags as the second attribute, it tells the value of the identified property
- http-equiv—gathers information for HTTP response message headers (i.e., for web browsers) and is used most often to identify the properties of content-type and the content-language
- name—metainformation which can have the properties keywords, description, author, and robots, among others, designed for search engines
- scheme—an attribute you are less likely to use, it names a scheme to interpret the value of the property
according to the Index of Attributes provided by the World Wide Web Consortium W3C.
The attribute charset is documented for HTML 5 in the working draft current in June, 2008, but already works in the current HTML 4.01, according to some sources. Currently, charset is also used as a subtype of the http-equiv content-type value.
Many mistakes are made in writing <meta> tags, according to the webstats report at code.google.com, and a great number have to do with confusion between elements, attributes, and values, and how to place them in the tag. Clarity is not aided by widespread confusion in Internet articles on the topic.
Where Should <meta> Tags Be Placed?
The <meta> tag is placed in the head, following the title tag:
<title>All About Azaleas</title>
<META name;”description” content=”Azalea cultivation and azalea showing guidance by experts who address visitors’ questions and participate in the A3 Forum.”>
You can easily see examples of how the basic structure is set up by going to your browser’s View > Page Source menu option and looking at the top of the file.
Parts of a <meta> Tag
- an opening carat <
- the word meta followed by a single space
- the name of the attribute, either http-equiv or name with no following space, but instead an = sign
- the name of the property in double quotation marks, so for http-equiv, likely “content-type” or “content-lang” or “content-style-type” and for name, likely “description” or “keywords” or “robots” or “author”
- a space
- content= (this must appear in every <meta> tag of any type
- the actual content of the tag, enclosed in double quote marks
- an end tag is forbidden in HTML <meta> tags, so simply close the carat >
Depending on whether you are writing an http-equivalent tag or a name tag, it will look like overall like one of these samples, substituting your own properties and values:
<meta http-equiv=”content-type” content=””text/html; charset=iso-8859-1″>
<META name=”Author” content=”Aloysius Hornswoggle”>
For more detailed information about using <meta> tags, please see the article “Making <meta> Tags Count.”