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

How to avoid hreflang return errors with URL that contain parameters

· 52CE 我爱测

I'm getting HREF no return errors in search console and I don't understand why. We have a page that contains buttons for get multiple pages of results. URL structure: Base page: `https://example.com/XX/publications` Pagination of…

问题原文

原帖链接 · Harald Stoll · CC BY-SA 3.0

I'm getting HREF no return errors in search console and I don't understand why.

We have a page that contains buttons for get multiple pages of results.

URL structure:

Base page: `https://example.com/XX/publications`
Pagination of results: `?count=50&page=4`
Actual url: `https://example.com/au/publications?count=50&page=4`

Source page:

<link rel="canonical" href="https://example.com/au/publications">
<link rel="alternate" hreflang="en-US" href="https://example.com/us/publications">

alternate page:

<link rel="canonical" href="https://example.com/au/publications">
<link rel="alternate" hreflang="en-AU" href="https://example.com/au/publications">

How can I tell Google that it should ignore the URL query parameters?

已采纳解答

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

The problem you have is caused by the combination of canonical and hreflang.

Your setup

Given your example: for the URL https://example.com/au/publications?count=50&page=4 you specify the following:

<link rel="canonical" href="https://example.com/au/publications">
<link rel="alternate" hreflang="en-US" href="https://example.com/us/publications">

What's going on?

This is how Google reads these information:

  1. This URL is a 1:1 duplicate of https://example.com/au/publications and I shall not index it
  2. but this URL also has an alternate language version for "en-US" available at https://example.com/us/publications

What does this mean to Google?

  1. the canonical is not a directive Google may respect it
  2. the hreflang is a very important information, Google has to validate it by checking the alternate URL for return tags

What you see in your Search Console is that Google is doing exactly this: It ignores your canonical, visits the defined alternate URL and checks whether it links back to the original URL (with parameters).

The specified alternate URL does not link back to the parameterized URL and therefore causes an error.

How to get rid of this mess?

First: try not to distract Google.

  1. If a URL is not a canonical URL - meaning is has parameters and links to a clean URL via link rel="canonical" → do not serve hreflang information.
  2. If a URL is a canonical URL- meaning it is the one you want to be indexed an rank in search results and it has alternate language versions → do serve hreflang information for each language.

Applied to your example

  1. for the URL https://example.com/au/publications?count=50&page=4 you only specify the canonical link: <link rel="canonical" href="https://example.com/au/publications">
  2. for the URL https://example.com/au/publications you specify
    1. the self referential canonical: <link rel="canonical" href="https://example.com/au/publications" />
    2. each language version: <link rel="alternate" hreflang="en-US" href="https://example.com/us/publications"> and <link rel="alternate" hreflang="en-AU" href="https://example.com/au/publications">

Now Google reads:

  1. https://example.com/au/publications?count=50&page=4is a 1:1 duplicate of https://example.com/au/publications → I shall not index it
  2. https://example.com/au/publications targets "en-AU" language users and has an alternate version for "en-US" users available at https://example.com/us/publications

Last but not least: be aware to only serve hreflang information, when there are translations available. If there are no translations of a specific URL it does not need hreflang annotation.


Sources

Visit the Google Guide on Use hreflang for language and regional URLs.

For your specific problem have a look at the video and wait for 08:50

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

资料来源与适用范围

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

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

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