Skip to main content
When a template renderer returns a string, OGify parses it with satori-html before passing the result to Satori. This is the HTML string path of the rendering pipeline.
JSX templates (returning ReactNode) skip this step entirely — the element tree goes directly to Satori. See Custom Templates for the recommended JSX approach.

How It Works

In code (renderTemplate):

classtw Mapping

satori-html converts standard HTML class attributes into Satori’s experimental tw prop. This lets you use Tailwind-like utility classes in HTML strings:
Equivalent JSX (no satori-html step):

Inline Styles

Use the style attribute for CSS properties not covered by utility classes:

When to Use HTML Strings

  • Migrating existing HTML-based OG templates
  • Simple layouts without conditional rendering
  • Prototyping with familiar HTML syntax
  • Conditional blocks ({showBadge ? ... : null})
  • Component composition and reuse
  • Type-safe props and IDE autocomplete
  • Using htmlSnippet for inline styled text

Limitations

HTML string constraints
  • No dangerouslySetInnerHTML equivalent — interpolate values directly into the string
  • Complex conditionals require string concatenation or ternaries in template literals
  • Arbitrary HTML tags may not be supported by Satori — stick to div, span, img, etc.
  • Not all Tailwind classes map correctly — see Styles
For inline styled words inside text (bold highlights, opacity variants), use htmlSnippet in JSX templates instead of raw HTML in strings.

Async HTML Renderers

HTML string renderers support async — useful when fetching data before building markup:

Comparison: HTML String vs JSX