1. 23
    Implement Dynamic OG Image Generation with Astro API Routes and Satori
    19m 27s

Implement Dynamic OG Image Generation with Astro API Routes and Satori

InstructorLazar Nikolov

Share this video with your friends

Send Tweet

Og images are important for any blog or website. They are the share image that is shown when you include a url to your site on social media.

Astro makes it easy to include og images within its SEO package but making these images dynamic takes a little more set up.

In this lesson we'll set up an Astro API route returns a link to a dynamic image utilizing satori and @resvg/resvg-js to do so.

The was we set it up, we'll create different templates that the API endpoint will accept and each template can render different end points so you could have a default template, one for your blog posts, and possibly another for your about page.

During this process, you'll learn how to pass data from the client to the server through URL Search Params which will power the dynamic portion of the image generation