问题
How do I specify that a page is in a certain language so search engines can understand?
Is it a meta tag I put at the top? If it is, do you know if most of the search engines use this to determine language?
I have converted 1 page of content in english to several different languages, and would like to include that information in the html/let the search engines know which language they are dealing with.
回答1:
Quick google search gave me this: HTTP and meta for language. tl;dr
<html lang="en">
There are other ways of specifying. If you are using apache, you can use a file extension for apache to pull the correct version based on the user-agent's given preferences. for example, name your index page index.html.en
, index.html.jp
, index.html.de
and so on...
回答2:
Depending on your dtd:
HTML:
<html lang="en">
XHTML:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
If you are using a right to left language:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="he" lang="he" dir="rtl">
If using XHTML, you'll want to specify both the xml:lang and lang attributes. The xml:lang attribute takes precedence over lang.
回答3:
Check this page for a range of things you can do to try to get the search engine to pick up the right language.
How to Specify an HTML Web Document Language for good SEO
(In no particular order)
- right domain suffix
- hosted in right county
- AddHeading syntax (Apache)
<meta http-equiv="Content-Language" content="yourlanguage" />
<html lang="yourlanguage">
for xhtml<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="yourlanguage" lang="yourlanguage">
<p lang="yourlanguage">
<meta http-equiv="content-type" content= "text/html; yourcharset">
- And search engines to text pattern analysis too (prefix/suffix of words, n-grams analysis)
来源:https://stackoverflow.com/questions/1071789/how-to-specify-language-of-website-html