Example Pre-rendering Configurations#
Our Node.js prerendercloud middleware and our prerendercloud-server are configured with sensible defaults but also support a variety of pre-rendering configurations. Here is how to think about the major levers you can pull to configure pre-rendering:
- What traffic do you want to pre-render?
- all traffic (default)
- bots only user-agents (most common)
- custom user-agent(s)
- What content do you want to pre-render?
- the entire page (default)
- only the meta tags (open graph and meta), see
prerender-meta-only
option
- How do you want to pre-render?
- forward traffic to our service (default, our service is fast but this is typically used with local caching)
- build all HTML in a batch process on a schedule and deploy to your origin
- Caching
- no local/middleware, and yes 5-minute (configurable) TTL of headless-render-api cache (default)
- yes local/middleware, and no headless-render-api cache
- yes local/middleware, and headless-render-api cache
Real World Examples#
- I have an Angular/React/Vue/etc app that Google refuses to index. I want to pre-render all traffic to it.
- I want to pre-render googlebot only.
- I want to pre-render all traffic except googlebot
- I want to pre-render but strip out all script tags because I don't care about client SPA functionality, see
prerender-remove-script-tags
- I want to pre-render the meta tags only because I only care about fixing link previews when someone pastes a link to my site on Facebook, Twitter, Slack, etc., see
prerender-meta-only
- I have very specific requirements for when and what to pre-render, see
shouldPrerenderAdditionalCheck: (req) => req.headers['user-agent'].match(/custom-stuff/)
in our Node.js middleware