Google如何使用jQuery的加载功能抓取内容? [英] how Google crawl content with jQuery's load function?

查看:75
本文介绍了Google如何使用jQuery的加载功能抓取内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在jQuery中使用.load功能时,我对SEO有疑问.

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

您可以通过引用单击的链接的href值来加载文档. 在第一种情况下,标记中提到了html文档存储的文件夹名称(../ajax/),而不是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:

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

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

或者您可以通过在jQuery中而不是标签中添加html文档的文件夹名称来加载文档.

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

代码: <a href="test.html">test</a>

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

我想知道哪种方法最适合SEO. 现在,我使用第一个示例,但是我注意到Google蜘蛛程序停止了我的导航,并且不进一步浏览该网站的其他页面. 但是我想,如果我尝试第二个示例,则Google蜘蛛会停止显示,因为链接中未提及目标文件夹...

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...

有人对此有经验吗?

推荐答案

您需要更改代码以明确提及不同的href目的地,而不要在代码库的javascript中对其进行混淆.

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

Google会抓取JS,但不会从变量名中推断出含义.

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

从本质上讲,我建议您使用JQuery来显示隐藏/显示内容,但不要使用主要导航.如果您希望更好地建立索引,请在HTML/CSS中对其进行静态重新编码.

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.

这篇关于Google如何使用jQuery的加载功能抓取内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆