- HTML Introduction
- HTML Attributes
- HTML Basic Tag
- HTML Color
- HTML Comments
- HTML Fonts
- HTML Blocks
- HTML Images
- HTML Layout
- HTML Links
- HTML Lists
- HTML Formatting Tags
- HTML Table
- HTML Meta Tag
- HTML Frames
- HTML Parse Tag
- HTML Forms
- HTML Script
- HTML Style-CSS
- HTML XHTML
HTML Meta Tags
HTML lets you define metadata - information about a document rather than document content -in a variety of ways. The META element can be used to include name/value pairs describing properties of the HTML document, such as author, Expiry Date, a list of key words etc. The <meta> tag is an empty element and thus does not have a closing tag, rather, <meta> tags carry information within attributes, so you need a forward slash character at the end of the element. Metadata is a very important part of the web. It can assist search engines to find best match. Search engines will often look for any metadata attached to a page - especially keywords, description - and rank it higher than another page with less relevant metadata, or with no metadata at all.
Adding Meta Tags to Your Documents:
We can add metadata to any web pages by placing <meta> tags between the <head> and </head> tags. We can include the following attributes:
|Name||Name for the property can be anything. For e.g. keywords, description, author, revised, generator etc.|
|Content||Specifies the property's value.|
|Scheme||Defines a scheme to interpret the properties value (as declared in the content attribute).|
|http-equiv||Used for http response message headers. For example http-equiv attribute can be used to refresh the page or to set a cookie. Some of more examples include content-type, expires, refresh and set-cookie|
NOTE:Core attributes for all the elements are discussed in next chapter.
Meta Tag Examples:
Let's see few important leverages of Meta Tags.
Keywords are used by search engine to search a web page. So by using following tag you can specify important keywords related to your page.
This is again important information and many search engine use this information while searching a web page. So you should give an appropriate description of the page.
You can specify a page redirection using Meta Tag. Following is an example of redirecting current page to another page. You can specify a duration after which page will be automatically redirected.
If a duration is not provided then page will be redirected immediately.
Meta Tag can be used to store cookies on client side later information can be used by Web Server to track a site visitor.
If the expiration date and time is not included, the cookie is considered a session cookie and will be deleted when the user exits the browser.
Setting Author Name:
Author name can be set in a web page using Meta Tag. See an example below: