3

Matt Cutts states in this video:

It turns out that as we are executing JavaScript, we do look at the attributes. So you can actually use Javascript and put, like, a nofollow attribute on individual URLs.

I'm not clear to me what the syntax for that would be. How would I put a nofollow on a link in a variable like this?

var mylink = "http://example.com/";

or if it in AJAX like this?

$.ajax({
    type: 'post',
    url: '/path/ajax-handler/' + method,
    success: function(data) ...

2 Answers 2

4

What he is referring to is the HTML markup of the page. The nofollow keyword goes into a rel attribute on a tag, usually an <a> tag with an href like so: <a href="/link" rel="nofollow">link</a>. So he is suggesting that if you don't want search engines parsing through your javascript and looking for links you can do this:

<script rel="nofollow" src="/js/code.js"></script>
1
  • I hadn't considered that. That would be decidedly less useful than I was hoping. Mar 28, 2013 at 16:42
0

There is no attribute "rel" in <script>, therefore the following code will produce a validation error in your CSS:

<script rel="nofollow" src="/js/code.js"></script>

Does Google follow JavaScript links? Yes. http://www.adherewebdesign.com/experiment/results/

Possible solution: Edit robots.txt to include the following line:

User-agent: * Disallow: http://offending-java-url.com

This will stop all bots from following the java link.

Also, You can verify your CSS validation here: http://validator.w3.org/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.