我可以在 iframe 标签中添加 rel nofollow 吗?

问题描述 投票:0回答:7

我有一个通过 iframe 分布在某些网站上的小部件。但我不希望谷歌机器人索引该网址。在

nofollow
标签中添加
iframe
可以解决问题吗?
Iframe
标签是否支持
nofollow
,Google会理解吗?

iframe seo
7个回答
7
投票

当然,您可以将

rel="nofollow"
添加到 iframe。你一定很狡猾。这是如何...

建立一个空白的 html 文件。仅将您的 iframe 添加到其中。在元标记中包括

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

现在,将该页面嵌入到您要显示的页面上。


3
投票

根据Google,您所需要的只是

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

“none - 相当于 noindex、nofollow”


2
投票

rel
元素不允许使用
iframe
属性。

查看

iframe
允许的属性:HTML5HTML 4.01


2
投票

这是不可能的,但有一个解决方法。您可以使用重定向到 IFRAME 的域 URL。在您的 robots.txt 中,您将阻止机器人跟踪您的 URL 链接。

在您的 robots.txt 添加

User-agent:*
Disallow:/h/

然后,如果您使用其他东西(例如 nginx),请在 htaccess 中创建 301 重定向或类似的东西。这会将本地 URL 重定向到 Iframe 的 URL。

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

在您的 iframe 中使用

<iframe src="https://yourdomain.com/h/fancy-url/?possibleparam=xx">

0
投票

根据 W3C 规范,“rel”不是“iframe”标记的可识别属性。您可以使用一些 javascript 和 document.write 将 iframe 代码放置在页面上


0
投票

您可能想检查一下 IFrame 是否被 Google 抓取? 但据我了解,iframe 上不允许“nofollow”


0
投票

延迟加载有助于不索引 iframe

<iframe loading="lazy" src="xyz" />

© www.soinside.com 2019 - 2024. All rights reserved.