最后更新于

多语言网页的SEO配置


对于多语言网站做SEO来说,需要在HTML代码的head部分加上对应的指示各个语言版本的页面。

🔗 HTML的head中的link示例

针对不匹配的语言使用x-default值:

<link rel="alternate" href="https://example.com/en-gb" hreflang="en-gb" />
<link rel="alternate" href="https://example.com/en-us" hreflang="en-us" />
<link rel="alternate" href="https://example.com/en-au" hreflang="en-au" />
<link rel="alternate" href="https://example.com/country-selector" hreflang="x-default" />

🌐 关于hreflang

hreflang属性的值是对应受支持的语言和区域代码,对应中文来说,如果要区分简体和繁体可以利用ISO 15924明确指定文字,例如:

  • zh-Hant:中文(繁体)
  • zh-Hans:中文(简体)

更多具体内容可参考:https://developers.google.com/search/docs/specialty/international/localized-versions?hl=zh-cn#language-codes

🗺️ 多语言Sitemap配置示例

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://www.example.com/english/page.html</loc>
    <xhtml:link
               rel="alternate"
               hreflang="de"
               href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="de-ch"
               href="https://www.example.de/schweiz-deutsch/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="en"
               href="https://www.example.com/english/page.html"/>
  </url>
  <url>
    <loc>https://www.example.de/deutsch/page.html</loc>
    <xhtml:link
               rel="alternate"
               hreflang="de"
               href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="de-ch"
               href="https://www.example.de/schweiz-deutsch/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="en"
               href="https://www.example.com/english/page.html"/>
  </url>
  <url>
    <loc>https://www.example.de/schweiz-deutsch/page.html</loc>
    <xhtml:link
               rel="alternate"
               hreflang="de"
               href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="de-ch"
               href="https://www.example.de/schweiz-deutsch/page.html"/>
    <xhtml:link
               rel="alternate"
               hreflang="en"
               href="https://www.example.com/english/page.html"/>
  </url>
</urlset>

🔍 验证工具

📚 参考文章

将网页的本地化版本告知Google: https://developers.google.com/search/docs/specialty/international/localized-versions?hl=zh-cn

一个包含多语言的参考网站: https://www.lionbridge.com/zh-hans/blog/translation-localization/9-essential-elements-intelligent-multilingual-website-design/