最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Will Google see rel=nofollow if it is added by jQuery? - Stack Overflow

programmeradmin1浏览0评论

I'm adding a rel=nofollow attribute to links via jQuery after the page load. Will Google see this attribute? I can't find anything in Google's official documentation.

I'm adding a rel=nofollow attribute to links via jQuery after the page load. Will Google see this attribute? I can't find anything in Google's official documentation.

Share Improve this question edited Dec 12, 2015 at 23:35 unor 96.9k28 gold badges225 silver badges381 bronze badges asked Dec 8, 2015 at 10:19 NatusNatus 316 bronze badges 1
  • Does this answer your question? Is it useless to add `nofollow` using Javascript? – Heretic Monkey Commented Aug 8, 2022 at 15:16
Add a ment  | 

3 Answers 3

Reset to default 6

Although Google processes JavaScript and can index a lot of dynamic content, there's a special behavior when inserting rel=nofollow dynamically. It was tested[1] and they came up with this result:

The nofollow in the DOM did not work (the link was followed, and the page indexed). Why? Because the modification of the a href element in the DOM happened too late: Google already crawled the link and queued the URL before it executed the JavaScript function that adds the rel=“nofollow” tag.

The solution is to insert the whole link with rel=nofollow dynamically:

However, if the entire a href element with nofollow is inserted in the DOM, the nofollow is seen at the same time as the link (and its URL) and is therefore respected.

See section "5. An Important Example with rel=”nofollow”" of the provided source.

Further reading

  1. We Tested How Googlebot Crawls Javascript And Here’s What We Learned

The Google spider does process Javascript, so adding the attribute via jQuery should work. I would suggest that you put the rel="nofollow" logic in your server-side code though, for guaranteed results.

Will Google see this attribute?

In short, No!, that link is already been crawled with google spider.

rel=nofollow this attribute should only work if you have set it at serverside when a request is made or you should put it static via keyboard, because after page load it doesn't matter.

发布评论

评论列表(0)

  1. 暂无评论