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

Use of canonical tag on website with different language versions AND separate mobile versions for each page

· 52CE 我爱测

I have a website where every page ( http://www.example.com ) has a separate mobile version ( http://m.example.com ). And I simply use the rel="canonical" tag on one of those two pages to avoid duplicate content issues with the se…

问题原文

原帖链接 · pauleric5 · CC BY-SA 4.0

I have a website where every page (http://www.example.com) has a separate mobile version (http://m.example.com). And I simply use the rel="canonical" tag on one of those two pages to avoid duplicate content issues with the search engines.

Now I am adding other language versions to the same website as subdirectories (http://www.example.com/fr/ for French version). The translated pages will also each have a separate mobile version (http://m.example.com/fr/).

I know that the rel="alternate" tag needs to be included on all existing pages to tell the search engines that these are just different language versions of the same page.

My question is: On which pages should I include the rel="canonical" tag? For example, if I do not include the canonical tag in one of the two French versions of a page, wouldn't search engines see the French mobile and non-mobile versions of a page as duplicate content?

And if I do include the canonical tag in one of the French pages, would that not create duplicate content issues again - because now the original language version (http://www.example.com) and the French version (http://www.example.com/fr/) of the same text both have canonical tags in them?

Or would the rel="alternate" tag linking the original language version of a page and its translated version make sure that both of these pages having canonical tags is not a duplicate content issue?

已采纳解答

原帖链接 · Luis Alberto Barandiaran · CC BY-SA 4.0

First, just to clarify, when you use a canonical tag, you have to use it in the actual canonical page and in the alternate version.

So, https://www.example.com/ should have the tag:

<link rel="canonical" href="https://www.example.com/"/>

And, https://m.example.com/ should also have the tag:

<link rel="canonical" href="https://www.example.com/"/>

Now let's add languages into the mix. From your example, let's say you have the page: https://www.example.com/fr/

Its meta tags should be:

<link rel="canonical" href="https://www.example.com/fr/"/>
<link rel="alternate" hreflang="en" href="https://www.example.com/" />
<link rel="alternate" hreflang="fr" href="https://www.example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />

The first line tells the search engine what the canonical page is. The second line, tells it where the English language version is located. The third line, which is self-referencing, reconfirms the French version (if you don't self-reference, you'll get a validation error). Finally, the fourth line tells the search engine that, if the user's language selection doesn't match any of the available ones, show them this page.

What about the mobile version, https://m.example.com/fr/

<link rel="canonical" href="https://www.example.com/fr/"/>
<link rel="alternate" hreflang="en" href="https://www.example.com/" />
<link rel="alternate" hreflang="fr" href="https://www.example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://www.example.com/" />

As you can see, they each point to the canonical version of each language.

Finally, I highly recommend you try an online validator to verify language and canonical tags. It's easy to set them up improperly.

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

资料来源与适用范围

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

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

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