meta tags in html

HTML allows several meta tags that appear between <head></head> tags. Meta tags serve various purposes.

The contain a metadata (information about information) about the web page. The crawlers from search engines visit and collect information provided in meta tags and put in the search engine’s database.

Meta tags can also be used set expiry time of a web page, that will erase web page from browser cache. They are also useful in refreshing a web page. The following is an example of meta tags

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="laptops, pcs, mobiles, samsung"  />
<meta name="description" content="We sell various electronic projects" />
<meta name="robots" content="nofollow" />
<meta name="robots" content="index,follow" />
<meta http-equiv="author" content="Jon Dukett" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="Fri, 04 Apr 2017 23:44:55 GMT" />
<meta http-equiv="refresh" content="5">

<title>Untitled Document</title>
</head>

<body>
</body>
</html>

The first meta tag appearing in above code is telling what type of content is contained in the web page. It is also setting the encoding type, which is utf-8 in this case. It is very important to keep encoding utf-8, otherwise, special characters may enter in database or there can be type incompatibility in web page and database’s data types.

The second meta tag is “keywords” which is maintaining a list of keywords representing the content presented on the page. These keywords are indexed by web crawlers of search engines

The third meta tag is “description” that contains a brief description of the website. This description appears as small text in search results about the website.

The fourth meta tag “robots” is used with property “nofollow” if we don’t want our page to be indexed by search enginesĀ ORĀ The fifth meta tag “robots” is used with property “index, follow” if we want our page to be indexed by search engines

The meta tag “author” stores information about author of the page

The meta tag “pragma” is set with property “no-cache” which will prevent browser from caching the page

The meta tag “expires” with the set time will inform the browser when to expire the page from the cache

and finally the last meta tag “refresh” will refresh the page after every 5 seconds. This can be useful if we want our page refresh again and again, for instance as happens in cricket score displaying websites to show the updated score after a few seconds interval.

Add a Comment

Your email address will not be published. Required fields are marked *