Syntax | <META> |
---|---|
Attribute Specifications |
|
Contents | Empty |
Contained in | HEAD |
The META element provides metadata such as a document's keywords, description, and author. Any number of META elements may be contained in the HEAD of a document.
META's NAME attribute provides a property name while the CONTENT attribute gives the corresponding value. The CONTENT attribute value may contain text and entities, but it may not contain HTML tags.
The optional SCHEME attribute gives the format of the property value. For example, a date property may require SCHEME="Month-Day-Year" to disambiguate the date from other formats such as SCHEME="Day-Month-Year".
There is no standard list of META properties, so authors may define whatever metadata they like. The following example defines the author of the document:
<META NAME=author CONTENT="Liam Quinn">
Some search engines use keywords and description properties, giving extra weight to a document's keywords and providing its description with the link to the document. Example:
<META NAME="description" CONTENT="A description of HTML 4.0's META element for metadata.">
<META NAME="keywords" CONTENT="META, meta element, metadata, metainformation, meta data, meta information, keywords, description, refresh, HyperText Markup Language, HTML, HTML4, HTML 4.0, Web Design Group, WDG, <meta> tag, <META> tag">
To avoid being truncated by search engines, the description should be brief--no more than 200 characters. Keywords are separated by commas and may be considered case sensitive by search engines. If the same keywords are repeated too often in the META element, some search engines will not index the document. Search engines typically only process the first 1000 characters of the keywords list.
Some search engines also support the robots property for indicating whether a document should be indexed and whether its links should be followed. The associated CONTENT value is a comma-separated list of case-insensitive directives:
For example, the following META element tells search engines and other robots not to index the page but to follow links on it:
<META NAME=robots CONTENT="noindex,follow">
Few search engines support the robots property at this time. For greater compliance by robots, authors should use the Robots Exclusion Protocol if possible.
The HTTP-EQUIV attribute may be used in place of the NAME attribute to indicate that the property is an HTTP header. Some servers will send the HTTP header specified in the META element, and browsers often recognize the header even when it is not sent by the server. Examples:
<META HTTP-EQUIV=Expires CONTENT="Sun, 22 Mar 1998 16:18:35 GMT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=SHIFT_JIS">
<META HTTP-EQUIV=Refresh CONTENT="10; URL=http://www.htmlhelp.com/">