大网数据广告活动
网站运营与故障问答

Server-side rendering for search engines only (SEO)

· 52CE 我爱测

I have a heavily JavaScript based web app which I want to make it indexable. I know that google bot and others agents can already see JavaScript, but I don't trust they will capture my content correctly and the problem is even bi…

问题原文

原帖链接 · lucaswxp · CC BY-SA 3.0

I have a heavily JavaScript based web app which I want to make it indexable.

I know that google bot and others agents can already see JavaScript, but I don't trust they will capture my content correctly and the problem is even bigger with asynchronous JavaScript. For examples: there are sections that are loaded only when the user scrolls down. There are also crawlers that can't see JavaScript, like Facebook's crawler.

Can I just send pre-rendered HTML, using phantomjs or other headless browser, to the google bot? This would be exactly what my end-users sees, but my fear is I may suffer penalties for serving different content for the bots.

已采纳解答

原帖链接 · Simon Hayter · CC BY-SA 3.0

Can I just send pre-rendered HTML, using phantomjs or other headless browser, to the google bot?

In short... no you shouldn't. Google's stance on differing versions for visitors and search bots is clear and regardless of your intentions it is classed as a cloak. Google also goes to great lengths to activity look for sites that specifically treat the Googlebot differently to other website visitors.

All sites should render the same with both Googlebot and Users

Every site regardless of the JavaScript should be render the same by both users and search engines, if it does not then there is something wrong with your site.

Emulating what Googlebot sees...

You can emulate and render what Googlebot sees when visiting your site by using the Google's Fetch Test with Google search console, with the results provided you can debug your site and ensure that its read and renders as expected for both search bots and users.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2017-02-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。