Meta Tags
Once upon a time, many eons ago, when the Internet was just a small number of cardboard boxes attached to each other with string, meta tags were the town criers of the Internet… erm… town.
Meta tags don’t do anything to the content that is presented in the browser window, but they are used by the likes of search engines to catalogue information about the web page.
There is one meta
tag which can be used as many times as you desire inside a head
element and they can contain the attributes charset
, name
, http-equiv
, and content
.
When the name
or http-equiv
attribute is used, the content
attribute is then used in conjunction with them to apply meta data itself.
Names
The name
attribute can be anything you like. The most commonly used names are author
, description
, and keywords
. author
is used to explicitly state one of the HTML page’s authors and description
is often used by search engines (such as Google) to display a description of a web page in its search results.
HTTP Equivalents
The http-equiv
attribute can be used instead of the name
attribute and will make an HTTP header, which is information sent to the server where the web page is held. The attribute should rarely be used (although see charset
note, below) but the value can be:
content-type
, an encoding declaration, defining what character set is being used,default-style
, the preferred stylesheet from a selection oflink
orstyle
elements,- or
refresh
, which defines how often (in seconds) a page automatically refreshes or if it should automatically redirect to another page. Not great for accessibility.
<head>
<title>Air conditioners? YEAH conditioners!</title>
<meta charset="utf-8">
<meta http-equiv="refresh" content="3"><!--not recommended for sane people-->
<meta name="description" content="This is my really, really, REALLY exciting web page about air conditioners">
...