问题
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