unisonweb / ui-core

Shared design system and core components for Unison Local and Unison Share
MIT License
23 stars 4 forks source link

Support preview snapshots of code for Open Graph links #32

Open hojberg opened 2 years ago

hojberg commented 2 years ago

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.

hojberg commented 2 years ago

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?

gampleman commented 2 years ago

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).

hojberg commented 2 years ago

Nice thats a very helpful insight!