Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(open-graph): Add emoji support to Satori #1593

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from

Conversation

Stephen-X
Copy link
Contributor

@Stephen-X Stephen-X commented Nov 16, 2024

This PR adds emoji support to satori when generating OG images. It's a port of the official satori example code: index.tsx, and defaults emoji svg source to twemoji.

Before

content-index md 0

After

content-index md

@Stephen-X Stephen-X force-pushed the dev/satori-emoji-support branch from 14bb97b to 93ca2c8 Compare November 16, 2024 07:49
Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just use the twemoji from node then?

And can we import util from satori to reduce code maintenance?

@Stephen-X
Copy link
Contributor Author

can we import util from satori to reduce code maintenance?

@aarnphm I didn't link it in the description (but in code), but here it is: twemoji.ts, it's also in their playground demo code directory. Satori's developer Vercel only officially implemented emoji support in their closed source version of satori: @vercel/og.

Should we just use the twemoji from node then?

I thought about adding dev dependencies, but liked the example code where they offered a lot of alternatives, e.g. the MS Fluent UI emoji version I'm personally using. Thought it'd be useful to leave it as-is for tech-savvy Quartz users to switch in code should they prefer a different look.

I don't know if folks would be OK with introducing a lot of dev dependencies only for emojis in the OG image generation use case.

For twemoji specially, the NPM package is just a thin wrapper around CDN cached SVG images (and MaxCDN has shut down so the plugin would not work out of the box).

Considering what the API does is really just downloading an svg over matching icon code, and these emojis do not change at all, I think there's less of a worry of maintaining the versions? twemoji looks abandoned so it wouldn't support future emoji versions. I'm not aware of another authoritative alternative (and the emoji design is also highly subjective) so keeping the apis API dictionary in code might be more nimble?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants