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

How come Google can properly fetch and render some sites using a SPA but not others?

· 52CE 我爱测

I have 2 websites, both use a single-page app framework. One uses React, and one uses Angular. Neither of them have any server-side rendering going on. When I run the "fetch and render as Google" tool on Search Console, the React…

问题原文

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

I have 2 websites, both use a single-page app framework. One uses React, and one uses Angular. Neither of them have any server-side rendering going on.

When I run the "fetch and render as Google" tool on Search Console, the React one displays as expected (and I can even verify that it's getting indexed by running searches against it).

When I do the same against the Angular one, I can see that Google is not capturing much of the information on the page:

What factor is at play here for one to render properly, and not the other? What can I do to ensure that a site made with a single-page framework is crawled correctly by Google?

已采纳解答

原帖链接 · Mike -- No longer here · CC BY-SA 3.0

I'm gonna answer this in terms of general frameworks because generally questions too specific on the details of one website are closed here.

For any engine to be able to successfully render data, you want to make it as basic and as easy to understand as possible. In the early days, no search engine was able to render Javascript code. This means that if a website was done entirely in javascript, then clients without javascript enabled will see nothing.

What you want to do to ensure almost any tool can render (at least the text of) your page is to ensure its accessible via basic HTML.

I would suggest testing your pages (regardless of framework used to generate the code) with as many browsers as possible including the old-fashioned lynx browser.

While I do understand google processes some Javascript, I'm sure its limited. For this reason, if you must use Javascript to render your pages, use the level of scripting that an ancient browser (like Internet explorer 7 or under) can support.

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

资料来源与适用范围

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

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

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