HTML: Multiple language meta descriptions?

后端 未结 2 1972
無奈伤痛
無奈伤痛 2020-12-31 05:02

How can I set two language meta descriptions to my website?

Is this code google valid?



        
2条回答
  •  旧时难觅i
    2020-12-31 05:29

    Check this post from Google Webmaster Central Blog: http://googlewebmastercentral.blogspot.com.es/2010/03/working-with-multilingual-websites.html

    "Google tries to determine the main languages of each one of your pages. You can help to make language recognition easier if you stick to only one language per page and avoid side-by-side translations. Although Google can recognize a page as being in more than one language, we recommend using the same language for all elements of a page: headers, sidebars, menus, etc. Keep in mind that Google ignores all code-level language information, from “lang” attributes to Document Type Definitions (DTD). Some web editing programs create these attributes automatically, and therefore they aren’t very reliable when trying to determine the language of a webpage."

    Some info about multi languages websites:

    Since html "lang" attribute doesn't allow define multiple languages, and meta attribute for specify language is obsolete, according to W3 recommendations, it's better to specify language in the HTTP header.

    HTTP/1.1·200·OK
    Date:·Sat,·23·Jul·2011·07:28:50·GMT
    Server:·Apache/2
    Content-Location:·qa-http-and-lang.en.php
    Vary:·negotiate,accept-language,Accept-Encoding
    TCN:·choice
    P3P:·policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
    Connection:·close
    Transfer-Encoding:·chunked
    Content-Type:·text/html; charset=utf-8
    Content-Language:·en
    

    Like the meta element with the http-equiv attribute set to Content-Language, the value of the HTTP header can be a comma-separated list of language tags

    See: http://tools.ietf.org/html/rfc2616#section-14.12

    As RFC2616 says:

    Multiple languages MAY be listed for content that is intended for
       multiple audiences. For example, a rendition of the "Treaty of
       Waitangi," presented simultaneously in the original Maori and English
       versions, would call for
    
           Content-Language: mi, en
    

    If you go to http://validator.w3.org/check and try to validate this:

    
    
    
    Test
    
    
    
    
    

    Test

    W3 validator tool says:

    Line 5, Column 52: Using the meta element to specify the document-wide default language is obsolete. Consider specifying the language on the root element instead.
    

    Then, if lang attribute on html tag doens't allow multiple languages, I think your best try will be specify it in HTTP header

提交回复
热议问题