Meta tags in HTML

Meta tags in HTML
 
Meta tags in HTML
  • Currently 0 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 0/5 (0 votes cast)

Thank you for rating!

You have already rated this page, you can only rate it once!

Your rating has been changed, thanks for rating!

Log in or create a user account to rate this page.


Meta tags are special tags in HTML that contain auxiliary information about the document. Meta tags and their contents are not displayed. They were designed for search engines, browser that are viewing with the page, caching proxy-servers and other programs that work with HTML. There are many different meta tags. During the development of the Internet environment, many have lost relevance and are not used anymore. Now, let's go through the main types of meta tags, which can come in handy when developing websites.

Meta tags are written in the block <head>:

<html>
  <head>
    <meta name="author" content="IT-development">
  </head>
  <body>
    <!- text page ->
  </body>
</html>

Meta tags can be written in one of two formats:

<meta name="name" content="value">

These are descriptive meta tags. They provide page properties, such as copyrights, summaries, instructions for search engines.

<meta http-equiv="name" content="meta tag value">

Information in the meta tags, which contain string http-equiv is used to transfer the corresponding HTTP-headers. These meta tags can control document caching, specify document encoding, send redirecting requests.

Interaction with search engines

Let's have a look at the meta tags that interact with search engines. Please note, these are the most controversial group of meta tags. Search engine spiders are paying less attention to the information in these tags and more to the textual content of the page itself, displayed to a visitor in a web browser. The reason is that these meta tags contain false information, in order to trick search engines and by any means direct a large number of visitors to the site.

Description

Meta tag description contains a brief summary of the document:

<meta name="description" content="description of your site.">

Every search engine has its own recommendation for the number of characters used in a description. Generally it's recommended to use no more than 255 characters.

Keywords

Meta tag keywords determines a list of keywords separated by commas or spaces that characterize the content of the page. For example, for a programming site a set of keywords would look like this:

<meta name="keywords" content="php, php-scripts, download">

Revisit

Meta tags revisit give recommendation to search engines, in how many days the page should be re-indexed:

<meta name="revisit" content="N days">
<meta name="revisit-after" content="N days">

Here, n - number of days. Please, note that this meta tag had almost completely lost its relevance and is ignored by most search engines.

Robots

Meta tags named robots can control site indexing. In particular, they can be used to disable indexing of certain pages. If a site, has many pages that don't contain useful or interesting information, use the tag to disable their indexing by search engines. In that case, the engines will pay more attention to the pages with relevant information. These meta tags have the following syntax:

<meta name="robots" content="parameters">

Following values can act as parameter:

  • index - page indexing;
  • follow - follow the links on the current page;
  • all - the same as two above values (follow and index) combined;
  • noindex - disable page indexing;
  • nofollow - to disable link follow up on the current page;
  • none - the same as noindex and nofollow combined.

Content of a document

Content type

This meta tag specifies MIME-type (media type) of the document and code page. The tag is written the following way:

<meta http-equiv="content-type" content="MIME-type; charset=code_page">

Example:

<meta http-equiv="content-type" content="text/html; charset=windows-1251">

The above states that the page is in HTML encoded in Windows-1251. This meta tag should be used with caution. Today, all browsers are able to determine the type and encoding of the document. If the specified encoding of document in the meta tag doesn't match the actual one, the document will be displayed in a bizarre way.

Content language

The header content-language allows to specify the language audience for which the page was intended. If the page was written for multilingual audience, in the body of the header, you can list multiple languages and separate them with commas.

Example:

<meta http-equiv="content-language" content="de">
<meta http-equiv="content-language" content="en,de">

Only specific language codes can be used, for example:

  • en - English;
  • us - American English.
  • fr - French;
  • de - German;
  • it - Italian;
  • ru - Russian.

Document state

The tag document-state allows you to specify the format of the document: static or dynamic.

<meta name="document-state" content="dynamiс">
<meta name="document-state" content ="static">

This meta tag is designed to work with search engines. The default value is dynamic. This means that the document is dynamic and must be periodically re-indexed. The value static is for static, rarely changing documents that don't need to be re-indexed.

Resource type

The meta tag resource-type specifies the type of document. For regular indexing the page should be set to value document.

<meta name="resource-type" content="document">

This meta tag can have the following values: build, classification, creation, formatter, host, operator, rating, site-languages, subject, template, version.

Generator

Name of the program, in which the page was created, for example:

<meta name="generator" content="name of the program>

Author

This meta tag shows authorship of the document. The tag value has free syntax. 

<meta name="author" content="author of the document">

Copyright

Copyright provisions of the document. The tag value has free syntax.

<meta name="copyright" content="copyright">

Caching

When caching the page is stored in a temporary place and when there is a query of this page, not the real versions is addressed but a locally saved copy. Caching can take place in browsers or trafficking proxy-servers. And because traffic is money, proxy-server administrators want to reduce it by all possible means, including by caching every visiting site. There are special meta tags that manage caching. Sometimes incorrect cache settings for proxy-servers lead to inability to receive update information. In that case, none of the mega tags will work and the only thing that helps is forced, manual update of each page by clicking Refresh.

Pragma

Meta tag sends a header named pragma, which is used to order browsers and proxy-servers running in HTTP 1.0, not to cache the page. The header pragma can have only one value - no-cache.

<meta http-equiv="pragma" content="no-cache">

Cache control

The header named cache-control was first introduced in HTTP 1.1 protocol and is used to control caching.

<meta http-equiv="cache-control" content="value">

The directives of this header must be carried out as follows "query-response" and rewrite caching directives set by default. This header can have the following values:

  • public - enables all caches, even if normally the response is not cached;
  • private - the whole response, or part of it can be cached only by one authorized user. For others caching is prohibited;
  • no-cache - no caching, no exceptions;
  • no-store - only temporary caching is allowed. Storing data in long-term memory is prohibited. However, this directive doesn't guarantee confidentiality of information. The user can manually save the page in the browser menu;
  • no-transform - prohibits the transformation of the transmitted data, which sometimes takes place in the third-party proxy-servers, for example, to reduce traffic;
  • must-revalidate - the directive is necessary to maintain reliable operation of the specific features of the protocol. If the directive is present the source server will be always addressed to validate the data. If addressing the source server failed, there must be an appropriate response. To release information without checking its validity is prohibited;
  • proxy-revalidate - this directive has the same value as the directive must-revalidate, but affects only the proxy-servers and has no effect on browser cache;
  • max-age - directive manages the time the cache is stored. This directive has a higher priority than the header expires, which also controls the amount of time the cached data is stored.

Examples:

<meta http-equiv="cache-control" content="public">
<meta http-equiv="cache-control" content="must-revalidate">
<meta http-equiv="cache-control" content="max-age=3600">

Expires

The header expires contains the date when the cache should be considered as outdated. Outdated data must be requested from their address in the network, and not from the cache. The value of the date must be absolute. Example:

<meta http-equiv="expires" content="Wed, 2 Mar 2005 00:00:05 GMT">

If an incorrect date format is specified, including the value 0, the date must be in the past. The header expires will be irrelevant if the header cache-control with the directive max-age is present.

Redirecting

Refresh

The header refresh sets the time in seconds, after which the browser redirects to a specified address. Example:

<meta http-equiv="refresh" content="5; url=example.html">

In this example the current page is redirected to the example.html in 5 seconds after the header is recognized. If you do not specify the URL, the page will redirect to itself.

Location

The header location specifies the address of a document on the Internet and can be used for redirecting. Example:

<meta http-equiv="location" content="url=http.www.example.com">

Attention

Almost all of the meta tags are only recommendations. They are taken into account not by all the search engines and browsers.


 

Read also

Conditional comments for IE

Conditional comments for IE

How to write in HTML

How to write in HTML

Discussion (total 1 comments)

Srinivasa Rao
August 01, 2013 at 10:07 am
very handy info. thanks for sharing..

Post comment

basicuse.net
html5_css
106160485398655174790

Quick navigation

General navigation