Search code examples
symfony1seoduplicatescanonical-link

what happens if there are two canonical tags in a page?


I am trying to add canonical structure for articles since Google is assuming that I am duplicating contents.

I am using symfony 1.0.6 and the success page is included in a layout and layout has its own canonical tag. I am adding another canonical tag dynamically in success page and it is resulting in multiple canonical tags.

I cannot remove canonical tag from layout since it will be used by many other templates..

I need to remove the canonical tag coming from layout and insert my own only for few templates ( dynamically) .

Is it possible to achieve it.


Solution

  • Usually in such occasions you separate the markup of your link in a template which includes logic to modify the attributes of the link based on where they are being _included. Have a little look at this article to see some more examples of templating engines.

    Hope this helps