Forum Moderators: open
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
for spanish it would be
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//ES"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
is there a list out there somewere to get the other language codes?
To specify the language of the document, you can use the
lang attribute on the html element, or send it as an HTTP header. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="es">
<head> ...etc.
thank you very much.
I am hoping this new code will help the spiders classify language content correctly.
thanks agina.
My original problem is a turist web site in 7 languages.
A hotel will have 7 different urles depending on the language. But I get the english site served to google.it searchers ...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
That you absolutely don't need:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Content-Language" content="en" />
?
Any ideas appreciated.
Sev.
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> You do absolutely have to specify the charset, but you are right in saying that the language meta tag can be replaced by the
lang attribute on the html element. However, the charset meta tag can be replaced by an HTTP header if you are generating dynamic pages, or you can specify the charset header in the server configuration. If neither of those options are available to you, then you must use the meta tag.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<title>The title</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-1" />
</head>
<body>
This above would server for a Spanish site. The first <xml...> declaration is arguable, I know. And I should have used utf-8 encoding, perhaps... ;)
<?xml version="1.0" encoding="ISO-8859-1"?> You should avoid using an XML declaration as it triggers quirks mode rendering in IE6. It is not required anyway for an XML 1.0 document, and certainly not for an XHTML document served as
text/html (as 99.9999% are). <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> I've argued over this before in other threads, but in short XHTML 1.1 is an inappropriate version of XHTML for general use, and anyway XHTML 1.0 Second Edition was released after 1.1 and includes improvements to the specification not present in 1.1. If you want to use XHTML, use 1.0.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es"> You should use the plain
lang attribute as well for better browser/search-engine compatibility. This is permitted in XHTML 1.0 (but not 1.1). <meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-1" /> If you want to send your document with the mine-type
application/xhtml+xml, specifying it in a meta tag alone isn't sufficient. In almost all case, you don't want application/xhtml+xml anyway - for one thing, IE doesn't understand it, nor do any major search engines. You should be specifying text/html instead. To recap, here is a basic template for an XHTML 1.0 Strict document where the document language is in Spanish:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" [b]xml:lang="es" lang="es"[/b]>
<head>
<title>XHTML 1.0 Strict template</title>
<meta http-equiv="Content-Type" content="[b]text/html[/b]; charset=iso-8859-1" />
</head>
<body>
<p>Hola!</p>
</body>
</html>