How To Use Nofollow Link In Script Tag
Solution 1:
The script
element can’t have a rel
attribute, so nofollow
can’t be used. Even if it could be used, note that nofollow
is not about disallowing bots to crawl/index the URL.
To disallow crawling the script, you have to use robots.txt:
User-agent: *
Disallow: /js/infolinks_main.js
Or if you want to disallow crawling of all your scripts:
User-agent: *
Disallow: /js/
You have to use the robots.txt file of the host where the scripts are hosted. It doesn’t necessarily have to be the host where your HTML documents are hosted.
(Note that this doesn’t disallow indexing the script. If you want to disallow indexing, you can use the X-Robots-Tag
header with a noindex
value, but then you have to allow crawling. As scripts are typically not indexed by general-purpose search engines, you probably want to prevent crawling, not indexing.)
Solution 2:
rel=nofollow only applies to hyperlinks, there's no point in adding it to any other kind of element.
If your scripts create links, you could edit the script to ensure that they do so with a rel=nofollow attribute; but given that the google bot does not execute scripts when reading a page, there's no real point in doing so.
Post a Comment for "How To Use Nofollow Link In Script Tag"