unisonweb/ui-core

Support preview snapshots of code for Open Graph links

hojberg opened this issue · 3 comments

When linking to a definition, instead of the default Open Graph image, we should show a preview of the source. If its a project (when those exist) it should have num stars and num downloads etc.

The challenge would be to create this image serverside—currently our routes serve up the same page and no server is involved.

It's possible to generate SVGs with React (and Elm) and use a node process to convert that to a PNG.

For share, these would be done on-demand, with some aggressive caching.


We should also update the description and title fields, this is probably a lower lift effort than the image portion.

Note that in Slack, it seems that code from GitHub is previewed directly as text that can be highlighted. This seems like a Slack specific thing and not an Open Graph thing.
Possibly the GitHub slack bot does this?

See https://api.slack.com/reference/messaging/link-unfurling. You can do this with a Slack App and perhaps this would be a nice thing to do once you have teams all in on using Unison, but perhaps not super high priority (as it would only work once you installed the App rather than in any Twitter/OpenGraph compatible thingy).

Nice thats a very helpful insight!