开发者

how to avoid crawler to follow anchor empty link (with jquery action)

I have in my site some links that are just used to display informative popups.

For example I have something like :

<a href="#" id="myLink">show more info</a>

And in my .js file I have something like :

$(document).ready(function() {
  $("#myLink).click(function() {
      displayPopup();
});
});

But google crawler or other crawler follow the link and tell me that it's a wrong link (it goes to my /usercontrol folder...)

How can I avoid crawler to follow this link ?

Should I pu开发者_开发百科t :

<a href="#" id="myLink" onclick="return false">show more info</a>

and keep my jquery as it is ?

Or put return false in Jquery click event ?

Or not use an anchor but a div instead ? is it gonna work in all browser in this case ?

Thanks for all


<a href="#" id="myLink" rel="nofollow">show more info</a>


As it's not really a link, you can use a span tag instead, and style it to look like you want. It will work in any browser that has Javascript enabled, just as your current solution.


As @Darin suggested, using the rel attribute with a value of nofollow is a good technique.

However, to prevent search engines from accessing or indexing parts of your site, you should use the Robots exclusion standard. See the interpretation of nofollow by various search engines.

To tell all user agents to not follow or index a given url, use a robots.txt file with the following contents:

User-agent: *
Disallow: /usercontrol/

Google and all other bots should respect the contents of your robots.txt file, and not index any links starting with the path /usercontrol/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜