swyxio / swyxkit

An opinionated blog starter for SvelteKit + Tailwind + Netlify. Refreshed for SvelteKit 1.0!
https://swyxkit.netlify.app/
MIT License
681 stars 89 forks source link

Dynamic `og-images` in Sveltekit with Satori #146

Open swyxio opened 1 year ago

swyxio commented 1 year ago

subtitle: thanks to Nate Moore and Geoff Rich

I've had #125 open for months, but didn't quite crack how best to do it. In October, Shu Ding from the Nextjs team released satori, but it only had docs for React and even though the underlying library is framework agnostic it was very hard to understand.

Thanks to @geoffrich for figuring it out:

{% twitter https://twitter.com/geoffrich_/status/1580954774434119680?s=20&t=jBpyCINN4woG6n_c8TLNJg %}

and now in #145 i have implemented it in swyxkit and you can see the PR for more details.

image

swyxio commented 1 year ago

unfortunately i am not able to ship this until https://github.com/yisibl/resvg-js/issues/175 is resolved. :/

swyxio commented 1 year ago

geoff rich made a repro for me that seems to work... https://github.com/geoffrich/sveltekit-satori-mdsvex-test

https://discord.com/channels/457912077277855764/1052606841345036308/1055908541191442442

swyxio commented 1 year ago

i manage to repro my issue merely by changing the code fence language: https://github.com/geoffrich/sveltekit-satori-mdsvex-test/pull/1