问题原文
原帖链接 · 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:
- This URL is a 1:1 duplicate of
https://example.com/au/publicationsand I shall not index it - 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?
- the canonical is not a directive Google may respect it
- 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.
- If a URL is not a canonical URL - meaning is has parameters and links to a clean URL via
link rel="canonical"→ do not servehreflanginformation. - 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
hreflanginformation for each language.
Applied to your example
- for the URL
https://example.com/au/publications?count=50&page=4you only specify the canonical link:<link rel="canonical" href="https://example.com/au/publications"> - for the URL https://example.com/au/publications you specify
- the self referential canonical:
<link rel="canonical" href="https://example.com/au/publications" /> - 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">
- the self referential canonical:
Now Google reads:
https://example.com/au/publications?count=50&page=4is a 1:1 duplicate ofhttps://example.com/au/publications→ I shall not index ithttps://example.com/au/publicationstargets "en-AU" language users and has an alternate version for "en-US" users available athttps://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
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
