simonw / til

Today I Learned
https://til.simonwillison.net
Apache License 2.0
1.02k stars 81 forks source link

Add social media cards #21

Closed simonw closed 3 years ago

simonw commented 3 years ago

So sharing on twitter is nicer.

simonw commented 3 years ago

I'd really love to have screenshots of the posts as the social media card images. I wonder what the best way to achieve that would be?

simonw commented 3 years ago

Built https://github.com/simonw/puppeteer-screenshot for screenshots. It takes a secret key, so the URL is something like:

https://puppeteer-screenshot.simonw.vercel.app/til.simonwillison.net/til/til/pytest_subprocess-server.md?key=...

I'm going to store the images in the database and use https://github.com/simonw/datasette-media to serve them.

simonw commented 3 years ago

Added two new secrets to this repo:

Secrets
simonw commented 3 years ago

Shipped and tweeted: https://twitter.com/simonw/status/1300868423774212096

It would be better if the aspect ratio was 2x1 though.

_2__Simon_Willison_on_Twitter___Added_social_media_preview_cards_to_my_TILs__https___t_co_H4Hg39EG9g____Twitter
simonw commented 3 years ago

That GitHub Actions run (attempting to rebuild everything) took too long so I'm rebuilding and deploying once on my laptop.

simonw commented 3 years ago

Shipped. Demo https://twitter.com/simonw/status/1300884226066190337

Simon_Willison_on_Twitter___Twitter_cards_look_better_at_2x1_aspect_ratio_so_I_added_viewportWidth__and_viewportHeight__arguments_to_my_screenshot_service_-_fresh_demo__https___t_co_S1O9f0yWZh____Twitter