Put this in your page's <head>. Swap in your own URL.
<meta property="og:image" content="https://snapog.com/s/https%3A%2F%2Fyoursite.com">
Now when someone drops your link in Slack or tweets it, there's an image.
We open your page in a browser — a real one, with JavaScript and everything. Then we take what's on screen and fit it into a 1200×630 image.
A few things make the result look better than a raw screenshot:
http or https.We cache images for about a week. Most of the time that's fine — your page doesn't change that often. But if you need a fresh one right now, there's a way.
You'll generate an Ed25519 keypair, publish the public half on your site, and sign refresh requests with the private half. It's a few commands.
openssl genpkey -algorithm Ed25519 -out snapog_private.pem
openssl pkey -in snapog_private.pem -pubout -out snapog_public.pem
# Get the raw public key as base64
openssl pkey -in snapog_public.pem -pubin -outform DER | tail -c 32 | base64
You can serve it as a JSON file at /.well-known/snapog.json:
{ "publicKey": "your-base64-public-key-here" }
Or just stick it in a meta tag:
<meta name="snapog-key" content="your-base64-public-key-here">
# Sign the exact URL you want refreshed
echo -n "https://yoursite.com/" | openssl pkeyutl -sign -inkey snapog_private.pem | base64 -w0
curl 'https://snapog.com/s/https%3A%2F%2Fyoursite.com?refresh=YOUR_BASE64_SIGNATURE'
If the signature is good, we throw out the old image and make a new one. If it's not, you just get whatever was cached. No error, no fuss.
We're working on npx snapog so you don't have to do the openssl dance yourself.