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 Answers
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,

- 643
- 2
- 12
- 30
-
I have decided that the a.html page is the main page. So may I place the following tag in between and in a.html? – Webengineer Mar 28 '18 at 07:04
-
Yup, Canonical tags can be self-referencial and you can add that `link` tag in `a.html`. If you're not going to delete `b.html`, you should add that tag to the head of `b.html` as well, to help the users (and the crawlers) recognize your canonical copy of the content and show it above the other copies. – versvs Mar 28 '18 at 07:09
-
Does it mean that I should keep in a.html and in b.html? Does it mean that I should keep in a.html and in b.html? – Webengineer Mar 28 '18 at 09:00
-
that's the recommendation if you don't delete `b.html` :) – versvs Mar 28 '18 at 09:21
-
(Option 1) Does it mean that I should keep in a.html and in b.html? ------------------------------------------- (Option 2) Does it mean that I should keep in a.html and in b.html? ------------------------------------------- Please advice me - which option is better. – Webengineer Mar 28 '18 at 10:58
-
The first one is the right one, the second b is wrong if a.html and b.html have the same content. Be sure to check the question a answered if this solves your issue :) Thanks! – versvs Mar 28 '18 at 11:50