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(www): add og images on docs & blog posts #3382

Merged
merged 119 commits into from Dec 15, 2022
Merged

feat(www): add og images on docs & blog posts #3382

merged 119 commits into from Dec 15, 2022

Conversation

KATT
Copy link
Member

@KATT KATT commented Dec 12, 2022

Moved from #3379

Closes #3364

🎯 Changes

Adds Open Graph image generation to www build step, adds og meta tags to blog posts. OG images are generated using the title metadata of the blog post (if one is not passed the text will be set to "tRPC Blog Post"). OG images are served as static png files.

Open Graph generation is done in memory using satori from vercel (which is what they use under the hood in their new @vercel/og library).

The background and font used for the og generation can be swapped out in static/og-assets.

One caveat is that there seems to be an issue with satori where it will clip the bottom of the image used, so the source background image needs to be taller than the target resolution (I used 720px height when targeting 640px and it looked good).

Swizzles the BlogPostPageMetadata component to add the og meta tags.

βœ… Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.

@vercel
Copy link

vercel bot commented Dec 12, 2022

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated
next-prisma-starter βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Dec 15, 2022 at 9:50PM (UTC)
og-image βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Dec 15, 2022 at 9:50PM (UTC)
www βœ… Ready (Inspect) Visit Preview πŸ’¬ Add your feedback Dec 15, 2022 at 9:50PM (UTC)

www/api/og.tsx Outdated Show resolved Hide resolved
www/vercel.json Outdated Show resolved Hide resolved
www/api/og.tsx Outdated Show resolved Hide resolved
www/package.json Outdated Show resolved Hide resolved
www/package.json Outdated Show resolved Hide resolved
www/package.json Outdated Show resolved Hide resolved
@KATT KATT changed the title Og images add og images on docs & blog posts Dec 12, 2022
@KATT KATT changed the title add og images on docs & blog posts feat(www): add og images on docs & blog posts Dec 12, 2022
# Conflicts:
#	pnpm-lock.yaml
#	www/package.json
Copy link
Member Author

@KATT KATT left a comment

Choose a reason for hiding this comment

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

let's gooo

@KATT KATT enabled auto-merge (squash) December 15, 2022 21:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
πŸ•Έ www Stuff to do with the website (`/www` folder)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: open graph images for articles & blog posts
5 participants