Khamis, April 25

Chapter 2: Adding Text


Meta Tags

Finally, you get to do something with the <head> tag. So far, you've only seen the <title> tag used to give information about the document, but you can do a lot more with the <head> tag. What's more, aside from the <title> tag, information in the <head> tag doesn't usually appear in your document. You can use the meta information tag (<meta>) to identify the page's author, keywords used for searching, or a brief description to appear in search results. You also can use the <meta> tag to give commands to the browser. You can use as many <meta> tags as you like in your page. You'll learn how in the sections that follow.






Meta Information Tag

Search engines add the content of your Web pages to their indexes. When a potential visitor enters a search phrase, the search engine checks its index to find that word and returns any pages that include that word. But, what if you were a realtor and you worked hard at creating a Web page that included the words houses, housing, sale, and buy; but didn't include the phrase real estate? If that was the phrase your visitor was looking for, they would never find your page.You can use the <meta> tag to include product names, geographic locations, industry terms, and synonyms that people might be searching for. There are three <meta> tags that work to help improve your chances of being found by a search engine:
  • Keywords Keywords are words that you feel people might use to search for your Web page, or synonyms for words that appear in your document.
  • Description This is usually a paragraph of information about your page. Some search engines use the information in this tag to summarize your page, but other search engines use the first few lines of text in your actual document.
  • Author This is your opportunity to shine. Just in case someone is searching for your name, they will find your page if you enter that information into the <meta> tag.

Meta information for search engines comes in pairs: name and contents. The following HTML code includes meta information pairs for each of the preceding <meta> tags.
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
    transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xml:lang="en" lang="en">
<head>
<title>Your HTML Page</title>
<meta name="keywords" contents="words that people might
    use to search for your page." />
<meta name="description" contents="a brief paragraph describing
    your document." />
<meta name="author" contents="your name" />
</head>
<body>
<p>Insert your text here.</p>
</body>
</html>
Remember, <meta> tags only appear in the <head> section of an HTML file.


Refresh and Redirect Tags

There might be times when you want to replace one page with another or want to redirect a link. You might, for example, choose to include a splash page on your Web site. You can use the meta information to force the page to change within a given time span using the sample code that follows:
<meta http-equiv="refresh" content="time in seconds,
            URL of the new page" />
If you have a page that you update several times a day and you want to make sure that people always see the most recent version, you can enter the page's own URL in the refresh tag. When the browser sees the refresh tag, it presents the requested URL in the specified time.
<meta http-equiv="refresh" content="time in seconds,
            URL for this page" />





Tiada ulasan:

Catat Ulasan