For my startup I needed a way for certain pages to be pre-rendered so that crawlers can view the OG Tags and meta tags. This is so they can easy unfurl links and show the meta image and promo images.
What we get from doing this
- Dynamic title tags
- Dynamic description
- Custom OG images and meta tags (For twitter, facebook etc)
Here is what it looks like.
How it works
- We build a Docker setup with nginx in front serving our static assets.
- Requests hit nginx
- Nginx determines if its a bot and serve up a prerendered version
- If the request is not a bot, it serves up the SPA version.
See the following link for Github gist with the Dockerfile and nginx.conf
Redwood Cookbook - Getting OG and meta tags working with nginx, pre-render.io and docker (github.com)
I currently deploy this using render.com which deploys this config with each deploy and does a health check for uptime checks.
Community improvements welcome!
- Currently, this is using the hosted version of prerender.io, but the project is open source and this cookbook can be extended to include the self-hosted version.