问题原文
原帖链接 · Muhammad Ahmad · CC BY-SA 4.0
I recently started blogging through blogger. On my Google Search Console account, I got the error "Duplicate without user-selected canonical" error. When I inspected the affected pages I saw:
?m=1
at the end of the affected URLs. I saw a fix online and added the following line in the HTML of my Blogger account:
<link expr:href='data:blog.url' rel='canonical'/>
I also saw a similar line to the one above which is as follows:
<link expr:href='data:blog.url.canonical' rel= 'canonical'/>
I wanted to ask that is there a difference between these two lines of code. Which one is the correct line? Also if the original URL without ?m=1 is indexed and the URL with ?m=1 is not indexed should I leave it like this or do I need to enter one of the above line in the HTML code of my website?
已采纳解答
原帖链接 · Rohit Gupta · CC BY-SA 4.0
An URL with a parameter is a different URL as compared to one without a parameter. If they both serve the same page then you have a duplicate page. The fix is to put a canonical tag with the preferred URL in it.
What is a canonical URL?
A canonical URL is the URL of the page that Google thinks is most representative from a set of duplicate pages on your site. For example, if you have URLs for the same page (
example.com?dress=1234andexample.com/dresses/1234), Google chooses one as canonical.
From developers.google
<link rel="canonical" href="https://www.example.com"> or
<link rel="canonical" href="https://example.com">
are the normal way to specify a canonical, depending on whether you are supporting www. But it is advisable to put in a complete (absolute) Link. If you do not do that then you can still have duplication because of http/https protocol and www/non www preferences.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
