Heading

Character Encoding and Language



As well as the Document Type Definition (essential), the Title Element (essential), the META Description Tag (desirable) and the META Keyword Tag (optional) there are two other tags which help validate the page. They will not affect the ranking of the page but they will help browsers and other user agents in certain circumstances.

The first declares the character encoding and lets the browser know whether to use the Chinese, Thai, Arabic, Latin (English) script or some other character set. It should look something like this:
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
There are also other schemes such as UTF-8 but unless you are developing for a foreign language other than most western European languages such as English, French, Italian etc., ISO-8859-1 is will be sufficient.
The second declares what language the page is in and should look something like this:
<meta http-equiv=”Content-Language” content=”en”>
The language codes can vary but again, unless you are developing for a non-English speaking audience the above will be sufficient.
These two tags should come before the Title element and using the same example as was used for the other tags would look like this:
<!doctype HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<meta http-equiv=”Content-Language” content=”en”>

<title>Retail Store Fixtures and Retail Store Display Supplies</title>
<meta name=”Description” content=”All your retail store display requirements at discounted prices with next day delivery. An online catalog of retail store fixtures from G.Brown Company Inc.”>
<meta name=”Keywords” content=”store fixtures, store display, retail display, retail fixtures”>
<link type=”text/css” rel=”stylesheet” src=”/path/file.css”>
<script type=”text/javascript” language=”javascript” src=”/path/file.js”></script>
</head>
<body>
.
.
The content of your page goes here.
.
.
</body>
</html>


Document Type Definition


The very first line of every page on your site should be the DOCTYPE! Declaration which tells browsers and other user agents what kind of HTML it will find on the page.
There are lots of different kinds of HTML (e.g. HTML 4.01 Strict, HTML 4.01 Transitional, XHTML 1.0 Strict etc.) and if there is no Document Type Definition (DTD) then browsers will switch out of ‘Standards Compliant’ mode into ‘Quirks Mode’ with unpredictable results.

Having a DTD will not affect your ranking in the SERPs directly but if you use a markup validator to check the syntax of your HTML you can be sure that browsers and search engines will see what you intended them to see and not their best guess at your intentions.
Here is a link to W3C list of recommended DTDs that you can use on your pages. Using the example page structure from the Keyword Meta Tag post it should look something like this depending on your chosen DTD:
<!doctype HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<meta http-equiv=”Content-Language” content=”en”>
<title>Retail Store Fixtures and Retail Store Display Supplies</title>
<meta name=”Description” content=”All your retail store display requirements at discounted prices with next day delivery. An online catalog of retail store fixtures from G.Brown Company Inc.”>
<meta name=”Keywords” content=”store fixtures, store display, retail display, retail fixtures”>
<link type=”text/css” rel=”stylesheet” src=”/path/file.css”>
<script type=”text/javascript” language=”javascript” src=”/path/file.js”></script>
</head>
<body>
.
.
The content of your page goes here.
.
.
</body>
</html>
For further reading Jeffrey Zeldman (whose book is in the Essential Reading list on the home page) has a good article Fix Your Site With the Right DOCTYPE!

0 Responses to "Heading"

Leave a Reply