Search code examples
htmliframeseocanonical-link

How should I treat iframe and canonical tag?


I have a page which contains an animation that is embeded in thousands of websites where the company I work for run ads.

However I would like to embed this animation in the website of the company that I work for because they produced the animation (of course). When our ad-partners embed our animation they use an iframe pointing to

http://example.com/pagina_animacao/

So I created a page inside the company I work for's domain containing this exactly iframe:

http://example.com/?q=aceitar-contrato-criacao-site

Because this iframe can be considered as duplicate content (it is published at /?q=aceitar-contrato-criacao-site and at /pagina_animacao/) I went to the URL /pagina_animacao/ and configured the canonical tag as:

<link rel="canonical" href="http://example.com/?q=aceitar-contrato-criacao-site"/>

Is this the right thing regarding canonical standards to avoid having duplicated content?


Solution

  • After waiting some time to Google crawl this website I took a look at the report and indeed, the URL https://www.sitepor500.com.br/pagina_animacao/ is not being listed anymore as an indexed URL \o/

    I also used SEARCH CONSOLE (tool from Google) to see what Google was seeing at https://www.sitepor500.com.br/?q=aceitar-contrato-criacao-site and it crawled this page CONSIDERING the content of the iframe! I just did a search at google by:

    site:sitepor500.com.br "semantic ui"
    

    And Google showed at the result the link that CONTAINS the iframe! \o/ I used the word "semantic ui" cause that 2 words only appears inside the iframe in my entire domain. So it's a pretty good test case!

    So you CAN and you SHOULD use canonical tag inside iframe cause people MAY embed your iframe in external content and your iframe content will probably appear as duplicated content!