If you’re using a single-page app for a site that’s not behind a login, SEO is an important concern.
Google, Bing, and other search engines and crawlers support Google’s standard for Ajax Crawling.
Normally Google will penalize sites heavily for using “cloaking”, meaning showing different content to Google than to normal web visitors, but for single page apps they have an exception. When detecting a single page app their crawler will send an
_escaped_fragment_ query parameter in the request, and the origin server can then choose to return a document that represents the content a user will actually get when the single page app is running.
# Set up prerendering
Netlify comes with built-in prerendering. You can enable it for your site at.
Our built-in prerendering service will cache prerendered pages for between 24 and 48 hours; this is not adjustable.
# External services
You can also use external services that can automate prerendering for you:
Prerender.io has an open-source version of their service that you can self-host.
If you want to use an external service, send us an email at email@example.com to let us know which service you’re using and its API token, and we’ll get you set up.
# How it works
We’ve taken great care to implement support for prerendering in the most efficient manner possible.
When a request hits one of our CDN servers, our CDN software determines if it’s a prerendering request from a crawler. If prerendering is enabled for your site, our cache servers will contact the prerendering backend straight from our CDN nodes instead of serving the normal cached request.
If you’ve worked with Netlify support to configure an external service and the external prerendering backend makes good use of HTTP caching headers like max-age, ETags or Last-Modified dates, prerendered responses will be cached sensibly on our CDN edge nodes. In our initial tests we’ve seen average response times of ~100 ms to crawlers, which is low enough that Google will still give your site a SEO boost for being fast.
Visit our Support Forums to ask questions about understanding and debugging prerendering.
Did you find this doc useful?
Your feedback helps us improve our docs.