Forum Moderators: open
I run a site with two language versions, english at the main domain & spanish which are pointed with a subdomain. Every page has a line:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
and:
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
this is for english content, for the subdomain:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
and:
<meta http-equiv="Content-Language" content="es">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
this for the spanish one.
My doubt is if it's ok, and second, if spiders get confused with this statements.
Should I remove this code and let them choose?
Gus
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>HTML 4.01 Transitional template</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
... content here ...
</body>
</html>
Note that having a DOCTYPE is obligatory, as is defining the content language and the charset, so don't remove them, or your pages will no longer be valid. Using the meta tag to define the language is fine too, but my version is shorter!
W3C Reference:
Gobal Structure of an HTML Document [w3.org]
Try the following template - if the new DOCTYPE causes problems, you can remove the w3.org url part to force newer browsers into quirks mode rather than standards-compliance mode.
You know, I used to do this back in the beginning of my career in validation. It was recommended that I remove the DTD reference due to a problem I was having with a top margin in IE. Removing the DTD reference cleared it up.
But, you know what, I found out that was not the problem. It was something I had in my CSS that was causing the issue. When you force a browser into quirks mode, you are defeating the sole purpose of validation and using the DOCTYPE to begin with.
I no longer recommend that you use shortened DOCTYPEs. Always use the full reference. If you run into problems at the browser level, it is not the browser or the DOCTYPE, it is your css or html that is causing the problem.
The value of the Content attribute of the META element is the same as the value of the Content-Language header in HTTP; i.e, a comma-separated list of language codes. For example: <meta http-equiv="content-language" content="fr,en">
From the W3C - Primary Language in HTML [w3.org]
The reason for recommending META as opposed to the HTML element with the lang attribute are: N-lingual document could be specified. For example, a bilingual French/Spanish document can be specified. The language(s) would be transmitted in the Content-Language field of HTTP header.
should be before the TITLE tag.
I have had several people write to me to tell me that for some websites, mainly those using languages where the use of that language requires downloading extra character set support for the browser, that if the title was first then the title displayed at the top of the browser window was corrupted, but if the title was second then it displayed OK. One of those concerned characters in Chinese. This may be a browser issue/bug rather than to do with official specifications. I haven't tried replicating the alleged behaviour.