In which page the "Canonical URL" meta tag should be placed (and how to write it on the right page?) when there are 2 pages called a.html and b.html which holds the same content?
1 Answer
If both files are in the same website, it is highly unrecommended to have duplicated content and one of those two pages should be removed (adding a Redirect from the removed to the final URL, to avoid 404 errors). Apart from the Moz link above, the official guide from Google, one of the most prominents search engines, is also clear: avoid having duplicated content across your websites.
Canonical URLs are best used when parts of a website are being republished elsewhere, it's a very elegant form of attributing the authorship and relevance to the original content generator.
Now, if you can't delete one of the pages of your project and redirect the URL to the other one, you need to decide which one is going to be considered as "main" from the project's point of view, and set the attribute canonical pointing to that URL.
I hope i helped you, and if I did solve your issue, don't forget to mark the answer :)
Regards,
-
I have decided that the a.html page is the main page. So may I place the following tag in between <head> and </head> in a.html? <link rel="canonical" href="example.com/a.html" /> Commented Mar 28, 2018 at 7:04
-
Yup, Canonical tags can be self-referencial and you can add that
link
tag ina.html
. If you're not going to deleteb.html
, you should add that tag to the head ofb.html
as well, to help the users (and the crawlers) recognize your canonical copy of the content and show it above the other copies.– versvsCommented Mar 28, 2018 at 7:09 -
Does it mean that I should keep <link rel="canonical" href="example.com/a.html"; /> in a.html and <link rel="canonical" href="example.com/a.html"; /> in b.html? Does it mean that I should keep <link rel="canonical" href="example.com/a.html"; /> in a.html and <link rel="canonical" href="example.com/b.html"; /> in b.html? Commented Mar 28, 2018 at 9:00
-
-
(Option 1) Does it mean that I should keep <link rel="canonical" href="example.com/a.html"; /> in a.html and <link rel="canonical" href="example.com/a.html"; /> in b.html? ------------------------------------------- (Option 2) Does it mean that I should keep <link rel="canonical" href="example.com/a.html"; /> in a.html and <link rel="canonical" href="example.com/b.html"; /> in b.html? ------------------------------------------- Please advice me - which option is better. Commented Mar 28, 2018 at 10:58