Most libraries provide a way to do Server-Side Rendering (SSR), which is perfect for SEO. But SSR is not always possible, so a Pre-rendering application such as Rendergun is another solution.
Pre-rendering is recommended by Google. Visit https://developers.google.com/search/docs/guides/dynamic-rendering to learn more.
Rendergun can be used as a Node.js CLI or Docker container.
# install rendergun install NPM $ npm i -g rendergun # start rendergun with default configuration $ rendergun
docker run --name rendergun -p 3000:3000 goenning/rendergun
|QueryString||url||Yes||which url to pre-render|
|Body||N/A||No||Rendergun will skip the initial page load of |
|HTTP Header||x-rendergun-wait-until||No||which chrome event to wait before returning the HTML. Possible values are |
|HTTP Header||x-rendergun-timeout||No||timeout in milliseconds for Chrome to load the page|
|HTTP Header||x-rendergun-abort-request||No||a RegExp that aborts all requests that matches it. Useful to skip requests to CSS/Images files that are not required for pre-rendering|
|HTTP Header||x-rendergun-block-ads||false||No||true/false if Rendergun should skip requests to Ads/Trackers domains. This gives a small performance improvement and avoid unecessary tracking|
This is used to verify if Rendergun and the Headless Chrome instance are healthy. If everything is OK,
200 status code is returned, otherwise
500. Rendergun will constantly monitor the health of Headless Chrome instance and restart it if necessary.
Rendergun can be customized by using Environment Variables. The following settings are available.
|PORT||which port Rendergun should bind to|
|CACHE_MAX_SIZE||how many megabytes should Rendergun use for caching|
|CACHE_MAX_AGE||how long (in seconds) should items be cached|