Understanding META tags is critical if you are serious about working with
search engines. They can be used to identify the creator of your webpage.
Some of the more important META tags are keywords, description, robots,
and refresh, which can be used to reload the page, or to load another page.
There are two types of META tags: HTTP-EQUIV and META tags with
a NAME attribute.
HTTP-EQUIV
META HTTP-EQUIV tags are the equivalent of HTTP headers. The header of a
webpage tells the Web browser information
which may be useful for displaying the HTML document.
Now, META tags. Just like normal headers, META HTTP-EQUIV tags usually
control or direct the actions of Web browsers, and are used to further refine
the information which is provided by the actual headers. HTTP-EQUIV tags are
designed to affect the Web browser in the same manner as normal headers.
NAME
META tags with a NAME attribute are used for META types which do not
correspond to normal HTTP headers. This is still a matter of disagreement among
developers, as some search engine agents (worms and robots) interpret tags which
contain the keyword attribute whether they are declared as "name" or
"http-equiv," adding fuel to the fires of confusion
Using META Tags
Ok, so you have a brief background on META tags,
so what do you actually do with these darn things?
One fantastic use is if you ever had people tell you that
they are seeing an old version of your page when you know you updated it,
you may want to stop their browser
from caching the Web pages. META tags, can tell the browser not to cache files,
and when to request a new version of the page.
Following are some of the META tags, what they are for, and how to put them
into your webpages.
Keyword and Description META Tags
These are probably the most common META tags.
Chances are if you manually code your Web pages,
you are aware of the
"keyword" and "description" attributes. These
allow the search engines to index your page using the keywords you
specifically tell it, along with a description of the site that you yourself get
to write.
Here is an example of a keyword META tag.
<META NAME ="keywords" CONTENT="computers,
internet, www, websites, homepages, HTML, XML, Java">
Don't get carried away and fill your keywords with words that don't appear in
your webpage as it can cause the search engines to ignore your page.
Here is an example of a Description META tag.
<META NAME="description" CONTENT="An
excellent page about omputers, the internet, www homepages or websites and the
programming languages used to build them like HTML, XML, and Java.
">
Notice
how we managed to use all of our keywords in our description. While it is
not necessary to use all your keywords in your
description, your description should be rich with your most important keywords
if are trying to get a favorable ranking in the search engines. Another
trick is to include the same description enclosed in comment
tags, just for the spiders that do not look at META tags. To do that, just use
the regular comment tags, like this:
<!--// This page is about the meaning of life, the universe, mankind and
plants. //--!>
ROBOTS
The Robots META tag can allow you to exclude pages you don't want to be
indexed by the spiders in the search engine. It can also tell the search
engine when to come back to look at the page again.
Here is an example of a robots META tag.
<META NAME="robots" CONTENT="all | none | index | noindex |
follow | nofollow">
The default for the robot attribute is "all". This would allow all
of the files to be indexed. "None" would tell the spider not to index
any files, and not to follow the hyperlinks on the page to other pages.
"Index" indicates that this page may be indexed by the spider, while
"follow" would mean that the spider is free to follow the links from
this page to other pages.
The inverse is also true, this META tag:
<META NAME="robots" CONTENT=" noindex">
would tell the spider not to index this page, but would allow it to follow
any links on this page and index the pages it finds. "nofollow"
would allow the
page itself to be indexed, but the links could not be followed. The Robots tag
allows you full control of how your site will be indexed by a spider. It
will not help you with Yahoo as Yahoo indexes your main page based upon a human
looking at it and deciding themselves what to do with it.
Expires
This tells the browser the date and time when the document
"expires." Dates must be in the RFC850 format(GMT format).
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997
08:21:57 GMT">
Pragma
This is another way to control browser caching.
To use this tag, the value must be "no-cache".
When this is included in a document, it prevents
browsers from caching a page locally.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
These two tags can be used as together as shown to keep your content current.
Refresh
This tag specifies the time in seconds before the Web browser reloads the
document. It can also specify a different URL for the browser to load.
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=http://www.newurl.com">
Don't forget to place quotation marks around the entire CONTENT
attribute’s value, or the page will not reload at all.
Set-Cookie
This is one method of setting a "cookie" in the user’s
Web browser.
If you use an expiration date, the cookie is considered permanent and will be
saved to disk (until it expires), otherwise it will be considered valid only for
the current session and will be erased upon closing the Web browser.
<META HTTP-EQUIV="Set-Cookie"
CONTENT="cookievalue=xxx;expires=Wednesday,
21-Oct-98 16:14:21 GMT; path=/">
Window-target
This one specifies the "named window" of the current page, and can be
used to prevent a page from appearing inside another framed page.
<META HTTP-EQUIV="Window-target"
CONTENT="_top">
Placement of META tags
META tags should always be placed in the head of the HTML document between the
actual <HEAD> tags, before the BODY tag. This is very important with
framed pages, as a lot of developers tend to forget to include them on
individual framed pages. Remember, if you only use META tags on the frameset
pages, you'll be missing a large number of potential hits.
|