大网数据广告活动
网站运营与故障问答

Google sitemap HrefLang tag without the main site url

· 52CE 我爱测

We have websites with multilingual content. e.g. http://www.example.com/about-us/ http://www.example.com/en-HK/about-us/ http://www.example.com/en-GB/about-us/ http://www.example.com/zn-CH/about-us/ We need to configure the hrefl…

问题原文

原帖链接 · Rashmi Pandit · CC BY-SA 3.0

We have websites with multilingual content.

e.g.

  • http://www.example.com/about-us/
  • http://www.example.com/en-HK/about-us/
  • http://www.example.com/en-GB/about-us/
  • http://www.example.com/zn-CH/about-us/

We need to configure the hreflang tags in sitemap for Google to know that there are alternate links for the same pages in different languages.

I know for the above example that my sitemap URL tag would look like this:

  <url>
    <loc>http://www.example.com/about-us</loc>
    <xhtml:link rel="alternate" hreflang="en-GB" href="http://www.example.com/en-GB/about-us"/>
    <xhtml:link rel="alternate" hreflang="en-HK" href="http://www.example.com/en-HK/about-us"/>
    <xhtml:link rel="alternate" hreflang="zn-CH" href="http://www.example.com/zn-CH/about-us"/>
    <changefreq>daily</changefreq>
    <priority>0.8</priority>
  </url>

However, if I don't have the main URL but just the last three ones with en-HK, en-GB and zn-CH, then how should my URL tag look? Should I just skip the loc tag and keep the three xhtml:link tags? Or can I specify any URL in the loc tag and put the remaining two in xhtml:link tags?

I am new to Google sitemaps. Any help is greatly appreciated.

Thanks, Rashmi

Edit: From the answer posted on https://stackoverflow.com/questions/18423624/sitemap-for-domain-with-multilanguage-site/18423803#18423803, for my example with sites in en-HK, en-GB and zn-CH, should there be three URL tags, with each of them assigned to loc with the other two in xhtml:link?

已采纳解答

原帖链接 · Rashmi Pandit · CC BY-SA 3.0

Ok. Found the answer at:

Help Google serve the correct language to your visitors

We need to have a url tag for each of the url and specify the others as alternate urls.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2014-06-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。