Приглашаем посетить
Татищев (tatischev.lit-info.ru)

The meta Element

Previous Page
Table of Contents
Next Page

The meta Element

Although it is not required in a document, the meta element performs so many different functions that it's a good idea to become familiar with it right away.

Document Encoding

Document encoding means setting the character set for your page, which is particularly important when writing documents in other languages. For many years, those of us writing in Latin characters (including English) used the ISO 8859-1 character set. The ISO sets and subsets cover a wide range of languages. But nowadays, we have UTF-8, a more universal format following a different standard than ISO values. UTF-8 can be helpful in a variety of browsers, but there are some limitations. If you are publishing in another language, such as Russian or Japanese, you'll want to have your document encoding set up under ISO rather than Unicode character sets.

NOTE

Ideally, character encoding is set on the server and not in a meta element. However, you can set it using a meta element. See http://www.webstandards.org/learn/askw3c/dec2002.html.


Example 1-7 shows a meta element that defines the UTF-8 format, suitable for documents in English as well as other languages, depending upon your browser support.

Example 1-7. Using meta to declare document encoding with Unicode
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Example 1-8 shows a meta element for a document written in Russian, using the ISO method.

Example 1-8. Using meta to declare document encoding for Cyrillic, using ISO
<meta http-equiv="Content-Type" content="text/html; charset= iso-8859-5" />

Keywords, Description, and Authorship

The meta element can be used to describe keywords, describe the site, and define the author, too. This is extremely helpful for public search engines as well as for any search engine you might be running on your own site.

Keywords are single words and word combinations that would be used during a search. This assists people looking for specific topics to find the information you're providing (see Example 1-9).

Example 1-9. Using meta for keywords and keyword combinations
<meta name="keywords" content="molly, molly.com, html, xhtml, css, design, web 
design, development, web development, perl, color, web color, blog, web log,
weblog, books, computer books, articles, tutorials, learn, author, instructor,
instruction, instructing, training, education, consult, consultation, consultant,
famous people page, famous people list, standards, web standards, web standards 
project, wsp, wasp, digital web, digital web magazine, web 
techniques, web techniques magazine, web review, webreview, webreview.com, wow, world
The meta Element organization
of webmasters, conference, conferences, user interface, usability, accessibility,
internationalization, web culture" />

You'll notice that although I use the word web a great deal, it's in combination with other keywords. Most search engines will lock you out if you use multiple single keywords. This used to be a way of getting higher ranking, but no longer. Use keywords that make sense, or if you want to have multiple instances of a word, use it in a realistic combination.

Descriptions are typically 25 words or less and describe the purpose of your document (see Example 1-10).

Example 1-10. The meta element used for site or page description
<meta name="description" content="I'm Molly E. Holzschlag, and this Web site 
shares my Web development work and personal thoughts." />

Short and to the point! Another use is to define the author of the document, as shown in Example 1-11.

Example 1-11. Using meta to describe page authorship
<meta name="Author" content="Molly E. Holzschlag" />

Of course, this information is never displayed on your web page itself. Instead, as with all elements and attributes within the head portion of a document, this information is used by the browser and other resources such as search engines.

NOTE

Other uses for the meta element are to refresh documents automatically and to restrict search engines from logging specific pages. Learn more at http://www.learnthat.com/courses/computer/metatags/meta.html.


    Previous Page
    Table of Contents
    Next Page