how Google crawl content with jQuery's load function?

為{幸葍}努か 提交于 2019-12-13 05:19:33

问题


I have a question regarding SEO, when you use the .load functionality in jQuery.

You can load a document by referring to the href value of the link you clicked. In this first case, the folder name where the html documents are stored (../ajax/) is mentioned in the tag, not in jQuery:

Code: <a href="ajax/test.html">test</a>

var thelink = $(this).attr('href');
$('#content').load(thelink);

Or you can load a document by adding the folder name of your html documents in your jQuery and not in your tag.

Code: <a href="test.html">test</a>

$('#content').load('ajax/test.html');

I wonder which method is the most seo friendly. I now use the first example, but I noticed that the google spiders stop at my navigation, and don't go further to the other pages of the site. But I suppose if I try the second example, the google spiders stop aswel, because the target folder is not mentioned in the links...

Anyone experience with this?


回答1:


You need to change your code to specifically mention the different href destinations clearly and not obfuscated in javascript in the codebase.

Google will crawl JS but will not infer meaning from variable names.

Essentially, I'd advise using JQuery for hide/reveal content stuff but not your primary navigation; recode this statically in HTML/CSS if you want to be indexed better.



来源:https://stackoverflow.com/questions/14455574/how-google-crawl-content-with-jquerys-load-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!