1 days ago · 4 min read · Web Development
Generating Social Images with Astro
Write HTML and CSS to generate custom social images for all of your content.
We all want our content to be the best possible experience for our visitors.
When a web page is shared on social media networks like Twitter or Mastodon, or in tools like Slack or Notion, a rich preview is displayed if the web page has the necessary metadata to show the image.
I wanted to ensure all of my pages had the best possible preview, so I built a URL-based generator to do just that.
My social images look like this:
My social images are generated by React components. 🤯
Here’s the code:
export type OgImageColor = 'primary' | 'success' | 'info' | 'black'
export type OgImageProps = {
title: string
color: OgImageColor
}
export const OgImage: React.FC<OgImageProps> = ({title, color = 'black'}) => {
const headingStyles = getColor(color)
return (
<div style={{
display: 'flex',
flexDirection: 'column',
width: '100%',
height: '100%',
padding: '54px 74px',
backgroundImage: `url(${dotGrid})`,
backgroundSize: '100% 100%'
}}>
<h1 style={{
fontSize: '84px',
fontWeight: 900,
...headingStyles
}}
>
{title}
</h1>
<h2 style={{
fontSize: '64px',
marginTop: 'auto',
color: 'transparent',
backgroundImage: 'linear-gradient(to right, rgb(250, 204, 21), rgb(217, 119, 6))',
backgroundClip: 'text'
}}
>
Chris D. MacRae
</h2>
</div>
)
}
function getColor(color: OgImageColor) {
switch (color) {
case 'primary':
return {
color: 'transparent',
backgroundImage: 'linear-gradient(to right, rgb(192, 132, 252), rgb(219, 39, 119))',
backgroundClip: 'text'
}
case 'success':
return {
color: 'transparent',
backgroundImage: 'linear-gradient(to right, rgb(74, 222, 128), rgb(8, 145, 178))',
backgroundClip: 'text'
}
case 'info':
return {
color: 'transparent',
backgroundImage: 'linear-gradient(to right, rgb(59, 130, 246), rgb(79, 70, 229))',
backgroundClip: 'text'
}
default:
return {
color: 'transparent',
backgroundImage: 'linear-gradient(to right, rgb(250, 204, 21), rgb(217, 119, 6))',
backgroundClip: 'text'
}
}
}
const dotGrid = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLAAAAJ2CAYAAABPQHtcAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAFfqSURBVHgB7d0xduM4FyZQgJR7/zurCiqobUwwwdgiOQRAmVS3jT+Cn4L7mbIA6gY8L3wHAPP/+b//b0siIiIiIiIiIiIvmimJiIiIiIiIiIi8cDSwRERERERERETkpaOBJSIiIiIiIiIiLx0NLBEREREREREReeloYImIiIiIiIiIyEtHA0tERERERERERF46GlgiIiIiIiIiIvLS0cASEREREREREZGXjgaWiIiIiIiIiIi8dDSwRERERERERETkpaOBJSIiIiIiIiIiLx0NLBEREREREREReeloYImIiIiIiIiIyEtHA0tERERERERERF46GlgiIiIiIiIiIvLS0cASEREREREREZGXjgaWiIiIiIiIiIi8dDSwRERERERERETkpaOBJSIiIiIiIiIiLx0NLBEREREREREReeloYImIiIiIiIiIyEtHA0tERERERERERF46GlgiIiIiIiIiIvLS0cASEREREREREZGXjgaWiIiIiIiIiIi8dDSwRERERERERETkpaOBJSIiIiIiIiIiLx0NLBEREREREREReeloYImIiIiIiIiIyEtHA0tERERERERERF46GlgiIiIiIiIiIvLSCW9g3W5Tmqdcx9v+95k6bPfLVx1t2+ctnud5nud5nud5nud5/gd9YMIbWNuaWqFSKcejILkVKx8F21q9tryL7ap4nud5nud5nud5nuf5H/GBid9CWIqQW2HODt9x7zHN9drpLvJV8TzP8zzP8zzP8zzP8z/iA5P/z//9f6GPcZumNO2f9/v9creUb2sFyufdMp2O354fmud5nud5nud5nud5nv8JH5HwFVjrXoVlXer4qcNX8ihObsNuR5DneZ7neZ7neZ7neZ4f5wMTvwJrntO6N7DWp6coldku3y1l1O0I8jzP8zzP8zzP8zzP80N9ROIPcS9rsLbtGG+fd//++b1/frVpbqXqdQR5nud5nud5nud5nuf5gT4w8Ye4bzndbrc6vJ5y/2zqlXqn4vM8z/M8z/M8z/M8z/MDfWDitxDeprQuW1pLt2//y5filAers/1fLkUtK7Wm3H6ov/M8z/M8z/M8z/M8z/M/4gMT3sAqS8CmvUj3p0OwSpnOBWuPbOn7PZk8z/M8z/M8z/M8z/P8eB+R+C2E+xMs61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8P84H5iXeQlhq8dUZWLVA+bxbpr09mTzP8zzP8zzP8zzP8/xYH5H4LYTbku73ex0/dfhKHsXJbdjtCPI8z/M8z/M8z/M8z/PjfGDCV2D9c3trTazjIPeWUpnt8t1SRt2OIM/zPM/zPM/zPM/zPD/URyR8BdbH8p62rRXh2uH7++f3/vnVprmVqtcR5Hme53me53me53me5wf6wIQ3sOY812KVXE+5f8pWr9Q7FZ/neZ7neZ7neZ7neZ4f6AMTf4j7bU7rsqS1Fm27FKkVsc72f7n8XlZqTbn9kHie53me53me53me5/kf84EJb2CVArztTaz3f72FMKdzwdojZf7dnkye53me53me53me53l+vI9I+BbCvHf4lrUd4H6W5DE65rk1unp7Mnme53me53me53me5/mBPjDhK7Debre07Q2s+/rftxBux+iRMu+dis/zPM/zPM/zPM/zPM+P9RGJfwvh/ePLFVjl+txvmVuheh1Bnud5nud5nud5nud5fqAPTHgD622+pXluj3EW5NhhmY+CtXql3qn4PM/zPM/zPM/zPM/z/EAfmPAGVunwrV+twNqL9znN9UrdjiDP8zzP8zzP8zzP8zw/zgcm/Ays2zzXM7CW7foYpXxbK1A+75Zpb08mz/M8z/M8z/M8z/M8P9ZHJHwF1rLe9+bVFyuwSh7FyW3Y7QjyPM/zPM/zPM/zPM/z43xg4t9COM91Ndr7fbncLZXZLt8tZdTtCPI8z/M8z/M8z/M8z/NDfUTiV2BtS/pYWvPqLNOW/v75vX9+tWlupep1BHme53me53me53me5/mBPjDhDaw5z2kqS7BSKVo+7uZntNUr9U7F53me53me53me53me5wf6wIRvIZymvRh7p2+tRdsuRWpFrLP9Xy6/7y5V//id53me53me53me53me/xEfmPAG1ly6fPvnvq6Xu6VM54K1R8r8uz2ZPM/zPM/zPM/zPM/z/HgfkfAthHme0rq1UpwleYyOeW6dvt6eTJ7neZ7neZ7neZ7neX6gD8xLrMAq1VrW62OU8rUi5cvdMu+dis/zPM/zPM/zPM/zPM+P9RF5gRVYZwnOMm31+txvmVuheh1Bnud5nud5nud5nud5fqAPTH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IiIiIiIi8dDSwREREREREREXnpaGCJiIiIiIiIiMhLRwNLREREREREREReOhpYIiIiIiIiIiLy0tHAEhERERERERGRl44GloiIiIiIiIiIvHQ0sERERERERERE5KWjgSUiIiIiIiIiIi8dDSwREREREREREXnpaGCJiIiIiIiIiMhLRwNLREREREREREReOhpYIiIiIiIiIiLy0tHAEhERERERERGRl44GloiIiIiIiIiIvHQ0sERERERERERE5KWjgSUiIiIiIiIiIi8dDSwREREREREREXnpaGCJiIiIiIiIiMhLRwNLREREREREREReOhpYIiIiIiIiIiLy0tHAEhERERERERGRl44GloiIiIiIiIiIvHQ0sERERERERERE5KWjgSUiIiIiIiIiIi8dDSwREREREREREXnpaGCJiIiIiIiIiMhLRwNLREREREREREReOhpYIiIiIiIiIiLy0vn/kBya6qWl3fgAAAAASUVORK5CYII=`
Enabling SSR
The first step to generating social images is enabling SSR (server-side rendering) for your Astro site.
We do this because generating these images at build time would be slow and, honestly, very frustrating to support.
I will be posting a follow-up on how to generate social images with SSG, however!
We enable SSR by editing our Astro config, found at astro.config.{js,cjs,mjs,ts}
:
import { defineConfig } from 'astro/config';
export default defineConfig({
output: 'server'
})
We’ll also need to enable an adaptor (essentially a plugin that builds our site for a specific hosting provider) for our hosting provider.
Astro supports a wide variety, so do your homework and pick the one that best suits you.
Then, for all of your existing pages, you need to opt back into SSG (static site generation). You can do this by adding the following to the frontmatter of your page:
---
export const prerender = true
---
<!-- Your page content >
Setting Up The Image Generator
To set up the image generator, we need to do 3 things:
We need to setup the React component (or raw HTML) for rendering the image content
We need to setup an API endpoint to do the image generation
We need to add the OG image meta tag to our pages
The result will look like this:
Generating the Social Image
To generate the social image, we can either:
I’ll take you through doing both.
Using an Astro component
To generate a component with Astro, we’re going to need to install the dependency satori-html
:
npm install satori-html
yarn add satori-html
Now, we create the component. We’ll create a simple component that renders a white background with your page’s title:
---
interface Props {
title: string
}
const { title } = Astro.props
---
<div class="container">
<h1>{title}</h1>
</div>
<style>
.container {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
h1 {
color: black;
font-size: 48px;
font-weight: 500;
}
</style>
Using a React or Preact component
To generate a component with React or Preact, we’re going to need to add the relevant Astro integration:
npx astro add react
npx astro add preact
Now, we create the component. We’ll create a simple component that renders a white background with your page’s title:
export interface OgImageProps {
title: string
}
export const OgImage = ({ title }: OgImageProps) => (
<div style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
height: '100%'
}}>
<h1 style={{
color: 'black',
fontSize: '48px',
fontweight: '500'
}}>
{title}
</h1>
</div>
)
Setting up the API endpoint
Now that we have a basic component that you can customize to generate your social images, we need to setup an API endpoint that will convert the component to a PNG and serve it to the browser.
We’ll do this in a few steps. To start, we’ll create a basic API endpoint that takes title
as an argument
via query params and returns a 404 if it’s not provided.
import type { APIRoute } from 'astro'
export const get: APIRoute = async () => {
const title = url.searchParams.get('title')
if (!title) {
return new Response(null, {
status: 500,
statusText: "Title missing"
})
}
return new Response(null, {
status: 200,
headers: {
'Content-Type': 'image/png',
},
})
}
Next, we’ll create a function to generate our image! To do so, we’ll need to install a few dependencies:
satori
: the image generation library that converts our HTML to a valid SVGsharp
: the image generation library that converts the aforementioned SVG to a PNGyoga-wasm-esm
: a library that allows loading WASM (web assembly) in Nodejs
npm install satori sharp yoga-wasm-esm
yarn add satori sharp yoga-wasm-esm
Now, let’s create our function by adding the following to our API endpoint:
import sharp from 'sharp'
// @ts-ignore: no types
import initYoga from 'yoga-wasm-web/asm'
// @ts-ignore: no types
import satori, { init as initSatori } from 'satori/wasm'
const YOGA = initYoga()
initSatori(YOGA)
type ImageOptions = {
site: string,
width: number
height: number,
debug?: boolean
}
async function generateImage(jsx: any, { width, height, debug }: ImageOptions) {
const roboto500 = await fetch("https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZ9hjp-Ek-_EeA.woff").then(
(res) => res.arrayBuffer()
)
const svg = await satori(
jsx,
{
debug: debug,
width: width,
height: height,
fonts: [
{
name: 'Roboto',
data: roboto400,
weight: 500,
style: 'normal',
}
]
}
)
return await sharp(Buffer.from(svg)).png().toBuffer()
}
Now, we can use the generateImage
function with our component to return an image from our endpoint:
import sharp from 'sharp'
// @ts-ignore: no types
import initYoga from 'yoga-wasm-web/asm'
// @ts-ignore: no types
import satori, { init as initSatori } from 'satori/wasm'
import Component from '../../components/OgImage.tsx'
const YOGA = initYoga()
initSatori(YOGA)
export const get: APIRoute = async () => {
const title = url.searchParams.get('title')
if (!title) {
return new Response(null, {
status: 500,
statusText: "Title missing"
})
}
const args = Object.fromEntries(url.searchParams)
const imageOptions = { site: site.href, width, height, debug }
const jsx = Component(args)
const buffer = await generateImage(jsx, imageOptions)
return new Response(buffer, {
status: 200,
headers: {
'Content-Type': 'image/png',
'Cache-Control': 'max-age=31536000, immutable',
},
})
}
type ImageOptions = {
site: string,
width: number
height: number,
debug?: boolean
}
async function generateImage(jsx: any, { width, height, debug }: ImageOptions) {
const roboto500 = await fetch("https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZ9hjp-Ek-_EeA.woff").then(
(res) => res.arrayBuffer()
)
const svg = await satori(
jsx,
{
debug: debug,
width: width,
height: height,
fonts: [
{
name: 'Roboto',
data: roboto400,
weight: 500,
style: 'normal',
}
]
}
)
return await sharp(Buffer.from(svg)).png().toBuffer()
}
import sharp from 'sharp'
// @ts-ignore: no types
import initYoga from 'yoga-wasm-web/asm'
// @ts-ignore: no types
import satori, { init as initSatori } from 'satori/wasm'
import Component from '../../components/OgImage.tsx'
const YOGA = initYoga()
initSatori(YOGA)
export const get: APIRoute = async () => {
const title = url.searchParams.get('title')
if (!title) {
return new Response(null, {
status: 500,
statusText: "Title missing"
})
}
const args = Object.fromEntries(url.searchParams)
const imageOptions = { site: site.href, width, height, debug }
const jsx = Component(args)
const buffer = await generateImage(jsx, imageOptions)
return new Response(buffer, {
status: 200,
headers: {
'Content-Type': 'image/png',
'Cache-Control': 'max-age=31536000, immutable',
},
})
}
type ImageOptions = {
site: string,
width: number
height: number,
debug?: boolean
}
async function generateImage(jsx: any, { width, height, debug }: ImageOptions) {
const roboto500 = await fetch("https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZ9hjp-Ek-_EeA.woff").then(
(res) => res.arrayBuffer()
)
const svg = await satori(
jsx,
{
debug: debug,
width: width,
height: height,
fonts: [
{
name: 'Roboto',
data: roboto400,
weight: 500,
style: 'normal',
}
]
}
)
return await sharp(Buffer.from(svg)).png().toBuffer()
}
type ImageOptions = {
site: string,
width: number
height: number,
debug?: boolean
}
async function generateImage(jsx: any, { width, height, debug }: ImageOptions) {
const roboto500 = await fetch("https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZ9hjp-Ek-_EeA.woff").then(
(res) => res.arrayBuffer()
)
const svg = await satori(
jsx,
{
debug: debug,
width: width,
height: height,
fonts: [
{
name: 'Roboto',
data: roboto400,
weight: 500,
style: 'normal',
}
]
}
)
return await sharp(Buffer.from(svg)).png().toBuffer()
}
import sharp from 'sharp'
// @ts-ignore: no types
import initYoga from 'yoga-wasm-web/asm'
// @ts-ignore: no types
import satori, { init as initSatori } from 'satori/wasm'
import { html } from 'satori-html'
import Component from '../../components/OgImage.astro'
const YOGA = initYoga()
initSatori(YOGA)
export const get: APIRoute = async () => {
const title = url.searchParams.get('title')
if (!title) {
return new Response(null, {
status: 500,
statusText: "Title missing"
})
}
const args = Object.fromEntries(url.searchParams)
const imageOptions = { site: site.href, width, height, debug }
const jsx = html(Component(args))
const buffer = await generateImage(jsx, imageOptions)
return new Response(buffer, {
status: 200,
headers: {
'Content-Type': 'image/png',
'Cache-Control': 'max-age=31536000, immutable',
},
})
}
type ImageOptions = {
site: string,
width: number
height: number,
debug?: boolean
}
async function generateImage(jsx: any, { width, height, debug }: ImageOptions) {
const roboto500 = await fetch("https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuI6fAZ9hjp-Ek-_EeA.woff").then(
(res) => res.arrayBuffer()
)
const svg = await satori(
jsx,
{
debug: debug,
width: width,
height: height,
fonts: [
{
name: 'Roboto',
data: roboto400,
weight: 500,
style: 'normal',
}
]
}
)
return await sharp(Buffer.from(svg)).png().toBuffer()
}
Now go forth, customize your component, and start generating your own social images!
Include social images in your pages
Now that your endpoint is working, you need to actually put the images on your pages.
In the <head>
of your page, add the following meta tags:
<meta property="og:image" content={/api/og.png?title=${title}`}/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="630"/>