6

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?

  • You want content="noindex, nofollow" in the meta, not rel="nofollow" as that's for href links designed for outbound use only. – Simon Hayter Feb 19 '15 at 16:46
  • @bybe Would that stop only iframes from being index or the entire page? I want the page with the iframes to be indexed. – Yin Yang Feb 19 '15 at 17:54
  • 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 :) – moldof May 24 at 7:43
4

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.

  • Something like <iframe src="..."><meta name="robots" content="noindex, nofollow"></iframe>? – Yin Yang Feb 22 '15 at 21:22
  • 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 Feb 22 '15 at 21:57
  • Sorry, I don't follow. Could you please post an example? – Yin Yang Feb 22 '15 at 22:03
  • 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). – dan Feb 22 '15 at 22:11
  • 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. – Yin Yang Feb 22 '15 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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