让谷歌从 javascript 生成的内容中索引链接 [英] Get google to index links from javascript generated content

查看:32
本文介绍了让谷歌从 javascript 生成的内容中索引链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站上,我有一个目录,它是通过 jquery ajax 调用生成的,随后会创建 html.据我所知,goole 和其他机器人不知道页面加载后 dom 的变化,也不会索引目录.

On my site I have a directory of things which is generated through jquery ajax calls, which subsequently creates the html. To my knwoledge goole and other bots aren't aware of dom changes after the page load, and won't index the directory.

我想要实现的是为搜索机器人提供一个专门的页面,该页面仅包含指向事物的链接.

What I'd like to achieve, is to serve the search bots a dedicated page which only contains the links to the things.

向目录页面添加 noscript 标签会是一个解决方案吗?(在 noscript 部分,我会链接到一个页面,该页面仅提供指向事物的链接.)

Would adding a noscript tag to the directory page be a solution? (in the noscript section, I would link to a page which merely serves the links to the things.)

我查看了 robots.txt 和元标记,但似乎都没有做我想要的.

I've looked at both the robots.txt and the meta tag, but neither seem to do what I want.

推荐答案

看起来像 你自己偶然发现了这个问题的答案,但无论如何我都会为后代发布这个问题的答案:

It looks like you stumbled on the answer to this yourself, but I'll post the answer to this question anyway for posterity:

实施 Google 的AJAX 抓取规范.如果指向您页面的链接包含 #!(URL 片段带有感叹号),Googlebot 会将 ! 之后的所有内容发送到特殊查询字符串参数 _escaped_fragment_ 中的服务器.

Implement Google's AJAX crawling specification. If links to your page contain #! (a URL fragment starting with an exclamation point), Googlebot will send everything after the ! to the server in the special query string parameter _escaped_fragment_.

然后在服务器代码中查找 _escaped_fragment_ 参数,如果存在,则返回静态 HTML.

You then look for the _escaped_fragment_ parameter in your server code, and if present, return static HTML.

(我在 这个答案中更详细地介绍了一些内容.)

这篇关于让谷歌从 javascript 生成的内容中索引链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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