Beginning HTML - Home
Introduction - What is HTML, What it can do, what you'll need, etc. The Basics - First steps in HTML. Moving On - Further concepts. Advanced - More advanced ways to use HTML. Glossary - Explanation of terms used in this site HTML Tag and attribute reference - look up the most popular tags and their common attributes for reference
Square Advanced
square Forms (Part One)
Square Forms (Part Two)
Square Frames (Part One)
Square Frames (Part Two)
Square Entities
Square Meta tags
Square Search engines
Square Publishing
Square Conclusion
 
What are Meta tags?
Including information for search engines
'Refreshing' the page to another page/site

What are Meta tags?

Meta tags are tags that hold 'hidden' information about the page - either information that the server can read or that the browser can read. Meta tags belong in the head section of the document. The information isn't seen by the user. The information can be a description of the page's contents, keywords to help search engines, and information about the author and the document. It can also be used to refresh the page, so that the user is taken to another page straight away.

Including information for search engines

The most common use for Meta tags is to embed information about the page that search engines can read, and therefore index your page better. You can use this to embed both a description and keywords about your site.
The <meta> tag does not use a closing tag. To embed keywords and a description, we'll use the <meta> tag along with two attributes - name and content. The content attribute is used to embed a short, concise description about the site.
For example, let's say we've created a web-site all about nutrition and fruit. We'd like to provide search engines with a summary/description of the site, and to help it index our site better, some keywords about the content. Example code might be -

<html>
<head>
<title>
Food nutrition and fruit
</title>
<meta name="keywords" content="nutrition, food, facts,pears, apples, oranges, bananas, mangoes, melons, tangerines, kiwi fruit">
<meta name="description" content="A site all about fruit and food nutrition. Find out all about the vitamin and mineral contents of different fruit.">
</head>
<body>
...the page content here
</body>
</html>

Refreshing to another page

Another common use of meta tags is to refresh the page so it takes the user to another page or another site. This could be especially useful if you've changed the address of a page or site, and you want to 'transport' the user to the new address.
To achieve this, we again use the <meta> tag, along with two attributes - http-equiv and content.
The http-equiv attribute always needs the value 'refresh'. The content attribute contains two values, separated by a semi-colon (;) and contained within quotes (""). The first value is the time in seconds before the page reloads/redirects, the second is the URL of the page you wish to forward to.
If you're doing this, it's worthwhile mentioning this on the page, e.g. "You are now being redirected to our new page. Please wait" - and setting the amount of seconds higher so that the user has time to read the message. It's also considered good practice to include a link to the page, in case the browser fails to forward them.
For example, suppose we've taken down the content of our site, and we'd now like all visitors to be forwarded to the Google search engine site instead. Here's the HTML we might use -

<html>
<head>
<title>Our site></title>
<meta http-equiv="refresh" content="10;"http://www.google.com">
</head>
<body>
We've given up on this site! You'll be forwarded to the Google search engine in 10 seconds. If your browser fails to forward you, <a href="http://www.google.com"> click here</a>.
</body>
</html>


OK, so now we know how to include information that's useful to search engines. Let's move on from here and discover some useful information about how search engines work..

TopTop of page - BackBack to Entities - Next - Search enginesNext

Introduction - The Basics - Moving On - Advanced - Glossary - Reference