How can I stop Google from indexing embedded iframes?

5,795

For some reason Google seems to be indexing the URLs of the iframes

As covered here, Google will indeed try to crawl and associate framed content with the page containing the frames.

Would rel="nofollow" work for iframes?

Within the header section of the iframe page (not the parent page containing the iframe), use:

<meta name="robots" content="noindex, nofollow">

As explained by Google here, this:

instructs web crawlers to not index the page and to not crawl any of the links on the page.

(If you just want to target the Googlebot and not other crawlers, then change name="robots" -> name="googlebot")

Based on pretty extensive experience with iframes, I can confirm that this prevents iframe pages from being indexed, while still allowing the parent page containing the iframe to be indexed.

Share:
5,795

Related videos on Youtube

Yin Yang
Author by

Yin Yang

Updated on September 18, 2022

Comments

  • Yin Yang
    Yin Yang over 1 year

    I have iframe widgets of external sources embedded on my website. For some reason Google seems to be indexing the URLs of the iframes and showing 404 errors for such URLs in the Crawl Section of Google Webmaster Tools. How can I stop Google from doing that?

    The URLs don't follow a pattern so I don't think I can use robots.txt for it. Would rel="nofollow" work for iframes?

    • Simon Hayter
      Simon Hayter about 9 years
      You want content="noindex, nofollow" in the meta, not rel="nofollow" as that's for href links designed for outbound use only.
    • Yin Yang
      Yin Yang about 9 years
      @bybe Would that stop only iframes from being index or the entire page? I want the page with the iframes to be indexed.
    • moldof
      moldof almost 5 years
      PROBLEM: if the iframe has no "src" and the htmlcode is embeded and the robot metatag is there the WHOLE Page is not indexed google finds a robot-meta tag in the html, regardless where :)
  • Yin Yang
    Yin Yang about 9 years
    Something like <iframe src="..."><meta name="robots" content="noindex, nofollow"></iframe>?
  • dan
    dan about 9 years
    Nope, that won't work. You'll need to place the noindex, nofollow meta tag in the head section of the iframe page, not in the parent page containing the iframe.
  • dan
    dan about 9 years
    See the first example in the link I provided from Google in my answer here. Use the robots meta tag from my answer the same way, in the source code of the iframe page (i.e., the page you have <iframe src= set to).
  • Yin Yang
    Yin Yang about 9 years
    How can I add the meta tags to source code for iframe if it is an external source? I'm not the owner of that iframe page and cannot edit it's content.
  • dan
    dan about 9 years
    Your question didn't indicate that you don't have access to the source code of the iframe page/widget (which is why you received the comments and above answer). Google should not be crawling or indexing URLs for a different domain. If you're receiving 404 errors from backlinks from another domain, then you can disavow those backlinks. Unless spammy or low-quality, 404 errors are not necessarily harmful and can be ignored.