本文介绍了Googlebot不会看到的jQuery生成的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery检索与JSON请求从数据库的内容。然后,它取代了在HTML(如%标题%)通配符与实际内容。这个伟大工程,这样我可以保持我的多语言文本在数据库中,但Googlebot的只看到了通配符,而不是实际的内容。我知道Googlebot看到没有JavaScript的网页,但有一个方法来处理呢?谢谢!

I use jQuery to retrieve content from the database with a json request. It then replaces a wildcard in the HTML (like %title%) with the actual content. This works great and this way I can maintain my multi-language texts in a database, but Googlebot only sees the wildcards, not the actual content. I know Googlebot sees pages without javascript, but is there a way to deal with this? Thanks!

推荐答案

您应该给的在谷歌彻底读。

You should give this document at Google a thorough read.

它讨论了如何使Googlebot的索引:

It discusses how to enable Googlebot to index:

  • 在网站网页上取决于URL变化 #hashfragment 值含量的变化。
  • 页,其中的内容变化后立即负载,但没有任何特殊的 #hashfragment 本身。
  • pages where content changes depending on changing #hashfragment values in the URL.
  • pages where content changes immediately upon load but lack any special #hashfragment per se.

总之,你看添加< META NAME =片段的内容=&GT!; 在第3步中讨论,并通过提供回所有的内容全部一次,您的客户端code否则将页面加载后,已经产生响应上的服务器端的特殊要求。这些特殊要求与实际要求?_ escaped_fragment _ = ... 的URL,指示它应该pre-烤(我的话)的服务器的所有的最后presentation到了Googlebot的一个回应。

In short, you're looking at adding the <meta name="fragment" content="!"> as discussed in "step 3", and responding to special requests on the server-side by delivering back all the content all at once, that your client code otherwise would have generated after page load. These special requests are actually requests with ?_escaped_fragment_=... in the URL, indicating to the server that it should pre-bake (my words) all of the final presentation into a single response for the Googlebot.

这是说,因为你会经历输出所填写的内容进行这种特殊情况下的功夫,你可能会更好做,在你一般的情况下(避免了需要处理谷歌的 _escaped_fragment _ 请求),也许还是一种页面加载后换出你的标记,如果有必要(例如,通过使用跨越的具有一定 ID 确定他们​​)。

That said, since you'd be going through the effort of outputting filled in content for this special case, you may be better off doing that in your general case (avoiding the need to deal with Google's _escaped_fragment_ requests), with perhaps still a way to swap out your markers after page load if necessary (e.g. through the use of spans with a certain class or id for identifying them).

这篇关于Googlebot不会看到的jQuery生成的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 08:47