让 google 从 javascript 生成的内容中索引链接
在我的网站上,我有一个通过 jquery ajax 调用生成的目录,随后创建了 html。 据我所知,goole 和其他机器人在页面加载后不知道 dom 更改,并且不会索引目录。
我想要实现的目标是为搜索机器人提供一个专门的页面,其中仅包含指向事物的链接。
向目录页面添加 noscript 标签是否是一个解决方案? (在 noscript 部分,我会链接到一个仅提供指向事物的链接的页面。)
我查看了 robots.txt 和元标记,但似乎都没有达到我想要的效果。
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.
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.)
I've looked at both the robots.txt and the meta tag, but neither seem to do what I want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您自己偶然发现了这个问题的答案,但我会无论如何,请为后代发布此问题的答案:
实施 Google 的 AJAX 抓取规范< /a>.如果指向您页面的链接包含
#!
(URL 片段 开头带有感叹号),Googlebot 会将!
之后的所有内容发送到特殊查询字符串参数_escaped_fragment_
中的服务器。然后,您在服务器代码中查找
_escaped_fragment_
参数,如果存在,则返回静态 HTML。(我在这个答案中进行了更详细的介绍。 )
It looks like you stumbled on the answer to this yourself, but I'll post the answer to this question anyway for posterity:
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_
.You then look for the
_escaped_fragment_
parameter in your server code, and if present, return static HTML.(I went into a little more detail in this answer.)