如何让我的AJAX内容抓取由谷歌? [英] How do I make my AJAX content crawlable by Google?
问题描述
我一直在使用jQuery的高度和载荷内容通过AJAX像这样一个网站:
I've been working on a site that uses jQuery heavily and loads in content via AJAX like so:
$('#newPageWrapper').load(newPath + ' .pageWrapper', function() {
//on load logic
}
如今,它已走到了我的注意,谷歌不会索引任何通过JavaScript动态加载的内容,所以我一直在寻找一个解决问题的办法。
It has now come to my attention that Google won't index any dynamically loaded content via Javascript and so I've been looking for a solution to the problem.
我已经通过谷歌的使Ajax应用程序抓取文件什么似乎是100次,我还是不明白如何实现它(在大多数情况下的服务器我的知识有限到期)。
I've read through Google's Making AJAX Applications Crawlable document what seems like 100 times and I still don't understand how to implement it (due in the most part to my limited knowledge of servers).
所以,我的第一个问题是:
So my first question would be:
- 有一个体面的一步一步的教程在那里,这个文件从开始到结束,你知道吗?我试着谷歌它,我没有找到任何有用的东西。
其次,如果没有什么在那里呢,会有人能够解释:
And secondly, if there isn't anything out there yet, would anyone be able to explain:
-
如何设置我的服务器来处理 对于包含URL的请求 _escaped_fragment _
How to 'Set up my server to handle requests for URLs that contain _escaped_fragment_'
如何实现 的HtmlUnit上 我的服务器上创建一个HTML 网页快照展现给 履带式。
How to implement HtmlUnit on my server to create an 'HTML snapshot' of the page to show to the crawler.
我会是令人难以置信的感激,如果有人可以提供一些线索这对我来说,先谢谢了!
I would be incredibly grateful if someone could shed some light on this for me, thanks in advance!
-Ben
推荐答案
我无法找到一个替代的,所以我把epascarello的建议,现在我生成与PHP的内容,如果该URL包括_escaped_fragment_(网址会包括如果一个爬虫访问)
I couldn't find an alternative so I took epascarello's advice and now I'm generating the content with php if the URL includes '_escaped_fragment_' (the URL will include that if a crawler visits)
对于那些搜索:
<?php
if(isset($_GET['_escaped_fragment_'])){
$newID = $_GET['_escaped_fragment_'];
//Generate page here
}
?>
这篇关于如何让我的AJAX内容抓取由谷歌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!