I have a photo sharing site. I inserted the canonical tag on header ( i have common header section for every page) of index page. but all pages show the same tag.

How can i implement canonical tag each page?

  • 1
    Hi there. First of all, why would you want a canonical tag on every page? The canonical tag is only used to tell Google which pages are duplicate content. Are all of your pages duplicate content? Secondly, to add a piece of code to every page on your site, usually this is done through PHP – Michael d Feb 27 '18 at 11:10
  • @michaeld it is very common to have canonicals on every page. Canonicals on the canonical page pointing to itself are just fine. Then if there are common issues that cause duplicate content such as parameters appended to the URL, you are covered. – Stephen Ostermiller Feb 27 '18 at 12:34
  • To solve this problem you would need to tell us more about your site. What software and programming language are you using? How do you want to determine where the canonical tags should point? – Stephen Ostermiller Feb 27 '18 at 12:36
  • You can edit the question to add additional info. – Stephen Ostermiller Feb 27 '18 at 12:36
  • That's true Stephen, you can canonical itself. Good point – Michael d Feb 27 '18 at 12:46

Edit: if you want to use canonical on every page, you can do it with Google Tag Manager.

There is no point on using canonical tag among all the site. You should only use it on pages with duplicate content.

For example, if you have http://example.com and http://example.com/index.php you should add the following tag in the page header of index.php.

<link rel="canonical" href="http://example.com" />

Searchers will discard http://example.com/index.php version. If you have http://example.com/products and http://example.com/poducts/sorted you should add at both pages:

<link rel="canonical" href="http://example.com/products" />

Not the answer you're looking for? Browse other questions tagged or ask your own question.