We are looking at migrating over pages written in HTML 4.01 to HTML5 and am looking at the minimum requirements when including meta tags in the <head>
element. For example, my current page which is HTML 4.01 compliant has the following meta tags:
<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="title" content="">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="created" content="2014-02-03T10:10:27.000-04:00">
<meta http-equiv="modified" content="2014-04-01T14:18:21.631-03:00">
<meta http-equiv="language" content="en">
<meta http-equiv="coverage" content="">
<meta http-equiv="publisher" content="">
My question is which one shoud be changed or removed and any other meta tag(s) need to be included.
There are no required meta
elements (with one exception, see below).
You can’t use just any metadata name (name
) or pragma directive (http-equiv
) like it was case in HTML 4.01. In HTML5, all values must be defined/registered in a certain manner.
So you’d have to check the spec and the wiki for possible values. If a value is not listed, don’t use it (or, if you are sure about it, register it).
meta
element that is sometimes requiredOnly if you don’t specify the character encoding in a different manner (e.g. in the Content-Type
HTTP header), you must use a meta
element for specifying it. See Specifying the document's character encoding.
If you use UTF-8, just add the following meta
element (ideally as the first child element of head
):
<meta charset="utf-8">