【发布时间】:2017-11-08 19:30:04
【问题描述】:
我想将 rel="nofollow" 属性应用于所有外部链接,并且没有像下面我的函数这样的内部链接,我不确定如何实现它?
我的第二个问题:使用 JavaScript 添加 rel="nofollow" 是真的吗?搜索引擎一般不执行 JavaScript?
<div class="post">
<h2 class="post title" >
<a href="https://www.exemple0.com/" title="web site" ></a>
</h2>
</div>
<div class="post">
<h3 class="post title" >
<a href="https://www.exemple1.com/" title="web site" ></a>
</h3>
<li class="tags">
<span class="tag"><span class="tel">hello</span><br>
<a target="_blank" href="http://www.exempleInternal.com"> internal</a>
</li>
</div>
<div class="post">
<h4 class="post title" >
<a href="https://www.exemple2.com/" title="web site" ></a>
</h4>
</div>
<script >
$(document).ready(function() {
(function($){
$('a').each(function(){
$(this).attr('rel', "nofollow");
});
});
})
</script>
【问题讨论】:
-
Google 执行 Javascript。此外,Google 建议您不要在内部链接上使用 nofollow。它只会伤害你。
-
大多数搜索引擎不会解析整个页面。所以通过 Javascript 添加是徒劳的。我听说谷歌会这样做,但我有一些情况是他们蜘蛛我的网站而不是变化的部分
-
好的,谢谢你,那我可以用类似我的函数的东西添加nofollow吗,因为我有一些链接,我可以添加其他的,所以我不能手动做......我可以做吗?跨度>
标签: javascript php href google-search nofollow