7

I have a widget distributed in some sites via an iframe. But I don't want the google bot index the url. Will adding a nofollow to iframe tag resolve the problem?. Does Iframe tag support nofollow, and will Google understand it?

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
smoreno
  • 3,129
  • 3
  • 32
  • 49

6 Answers6

7

Absolutely, you kind of can add rel="nofollow" to an iframe. You just must be tricky about it. Here's how...

Build a blank html file. Add your iframe to that alone. In the Meta tag include

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

Now, iframe that page onto the one your going to show.

L84
  • 45,514
  • 58
  • 177
  • 257
Ungoogle
  • 86
  • 1
  • 6
2

The rel attribute is not allowed for the iframe element.

See allowed attributes for iframe: HTML5, HTML 4.01

unor
  • 92,415
  • 26
  • 211
  • 360
2

According to Google, all you need is

<meta name="robots" content="none" />

“none - Equivalent to noindex, nofollow”

gregers
  • 12,523
  • 8
  • 46
  • 41
2

It is not possible but there is a workaround for it. You can use a URL of your domain that redirects to the IFRAME. In your robots.txt, you will prevent the bots to follow the link of your URL.

In your robots.txt add

User-agent:*
Disallow:/h/

Then, create a 301 redirect in your htaccess or something similar if you use something else like nginx. that will redirect a local URL to the URL of the Iframe.

Redirect 301 /h/fancy-url/ http://targetdomain.com/the-uri-of-iframe/

In your iframe use the

<iframe src="https://yourdomain.com/h/fancy-url/?possibleparam=xx">
Nicolas Guérinet
  • 2,086
  • 1
  • 29
  • 38
0

"rel" is not a recognised attribute for the "iframe" tag according to W3C specs. You could use some javascript and document.write to place the iframe code on the page

Kundan Sankhe
  • 224
  • 1
  • 11
0

you might want to check out is IFrame crawled by Google? but from my understanding the "nofollow" is not allowed on an iframe

Community
  • 1
  • 1
codeonfire
  • 25
  • 7