How to specify language of website? (HTML?)

房东的猫 提交于 2021-02-20 05:47:47

问题


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)

  1. right domain suffix
  2. hosted in right county
  3. AddHeading syntax (Apache)
  4. <meta http-equiv="Content-Language" content="yourlanguage" />
  5. <html lang="yourlanguage"> for xhtml <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="yourlanguage" lang="yourlanguage">
  6. <p lang="yourlanguage">
  7. <meta http-equiv="content-type" content= "text/html; yourcharset">
  8. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!