大家都知道,如果是google搜索SEO做外贸独立站是很有可能需要针对全球不同地区进行指定性的优化,目的就是精准的让对应地区的用户能够搜索到,这是很重要的环节。
网站设置多地区语言的文档说明:
以下是这3个网页的站点地图:
<?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>
针对不匹配的语言使用x-default值
当任何其他语言/区域都与用户的浏览器设置不匹配时,系统会使用保留值 x-default
。如果用户的语言设置与您网站的任何本地化版本均不匹配,那么建议您使用此值来指定后备页面。虽然 x-default
值可以用于任何网页,但它是专为语言选择器网页设计的,因此最适合这些网页。
无需为 x-default
值指定语言代码;相应网页针对的是其浏览器设置的语言与您网站使用的语言不匹配的用户,因此网页所用的语言无关紧要。
如需实现 hreflang="x-default"
注解,请再向现有的 hreflang
注解添加一个 link
标记,并将 href
属性设置为您希望用户到达的网址(如果您的网站不支持用户的语言)。例如,HTML 实现可能如下所示:
<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
时最常见的错误:
缺少返回链接:如果网页 X 链接到网页 Y,那么网页 Y 必须要链接回网页 X。如果所有使用 hreflang
注解的网页并未全部满足这项要求,系统可能会忽略或无法正确解译这些注解。例如,您可以考虑在 https://de.example.com/index.html
上使用此链接:
<link rel="alternate" hreflang="en-gb" href="https://en-gb.example.com/index.html" />
https://en-gb.example.com/index.html
上还必须要有一个 hreflang
,以便指回到内容的 de
版本:
<link rel="alternate" hreflang="de" href="https://de.example.com/index.html" />
语言代码不正确:确保您使用的所有语言代码均标识出备用网址的语言(以 ISO 639-1 格式表示)和区域(可选,以 ISO 3166-1 Alpha 2 格式表示)。仅指定区域是无效的。
提示:实际上就是用link元素添加rel="alternate"属性进行hreflang="地区"标记,而且服务器的IP地址也能有作用。
具体参考:https://developers.google.cn/search/docs/specialty/international/localized-versions?hl=zh-cn