This repository contains a simple single-page react app deployed to Heroku (for no good reason1) and fronted by a CDN use Prerender.io to create static HTML previews for bots.
- Heroku App: https://prerender-test-01b7e6f9b586.herokuapp.com/
- CDN: https://christopher-chudzicki.global.ssl.fastly.net/
The app includes dynamically generated metadata tags: these tags are rendered by Javascript (through React) based on API data.
The app contains two routes:
/: The homepage- no interesting metadata tags.
/pokemon/:namewhich uses PokeApi to fetch data.- Includes Opengraph metadata tags based on fetched data
/pokemon/dittoand/pokemon/pikachuare linked to from the homepage. Other pokemon routes work, but only these two are linked.
Social Media Previews:
| https://prerender-test-01b7e6f9b586.herokuapp.com/pokemon/charmander | https://christopher-chudzicki.global.ssl.fastly.net/pokemon/charmander |
|---|---|
| no prerender | with prerender |
![]() |
![]() |
You can see Prerender is only affecting bots by comparing
curl -A googlebot https://christopher-chudzicki.global.ssl.fastly.net/pokemon/pikachu
# and
curl https://christopher-chudzicki.global.ssl.fastly.net/pokemon/pikachuWith corepack enabled:
yarn installinstalls dependenciesyarn devstarts the server in development modeyarn buildbuilds the SPA for productionyarn startserves the SPA with a NodeJS express server
Footnotes
-
When deployed elsewhere, I either had trouble getting SPA routing to work (all paths serving index.html), or I had trouble getting Fastly CDN to read the origin correct. After finding Fastly's
Override Hostsetting, I overcame the latter issue on Heroku. Possibly that would have worked elsewhere. ↩

