gpt4 book ai didi

javascript - 如果是 jQuery 添加的,Google 会看到 rel=nofollow 吗?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:30:02 25 4
gpt4 key购买 nike

我在页面加载后通过 jQuery 添加一个 rel=nofollow 属性到链接。Google 会看到这个属性吗?我在 Google 的官方文档中找不到任何内容。

最佳答案

虽然 Google 处理 JavaScript 并且可以索引很多动态内容,但是当动态插入 rel=nofollow 时会有一种特殊的行为。这是tested[1]他们得出了这个结果:

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.

解决方案是插入整个链接 rel=nofollow 动态:

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.

请参阅所提供来源的“5. 一个带有 rel=”nofollow”的重要示例”部分。

进一步阅读

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

关于javascript - 如果是 jQuery 添加的,Google 会看到 rel=nofollow 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34153334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com