defineTemplate
ThedefineTemplate helper is the core building block. It ensures type safety and provides a structure for your template.
defineTemplate
Helper function to define a template with type safety. Use this when creating
custom templates for your Open Graph images.
Styling
We use Satori under the hood, which supports a subset of CSS properties. For a complete list of supported CSS features, see Styles.Inline Styles
You can simply write inline styles in your HTML string.Tailwind-like Classes
OGify’s renderer passes the HTML through a processor that understands basic Tailwind-like utility classes (e.g.,flex, p-4, text-center, bg-blue-500).
Dynamic Content
Your renderer function receivesparams which contains whatever data you pass during renderToImage. Use this to inject titles, images, dates, etc.
Best Practices
Keep it simple
Keep it simple
Satori is powerful but has some limitations compared to a full browser
engine. Avoid complex CSS selectors or deeply nested absolute positioning if
possible.
Use display: flex
Use display: flex
Flexbox is the most reliable way to layout content in Satori.
Test with isRTL
Test with isRTL
Ensure your template handles RTL content gracefully if you plan to support
international audiences.