@ogify/core library. These types provide full type safety when creating templates and configuring renderers.
Core Types
OgTemplateParams
Base type for template parameters. All template parameter types should extend this.- Strings: Text content (titles, descriptions, names)
- String Arrays: Lists of tags, categories
- Numbers: Counts, dates, metrics
- Booleans: Flags, toggles, states
OgTemplate
Complete definition of an Open Graph image template. A template is a reusable blueprint for generating OG images.Function that generates HTML markup from template parameters. The HTML should
use inline styles (Tailwind-like utilities are supported). Flexbox and basic
CSS properties are supported by Satori.
Custom fonts to use in this template. Fonts are loaded in the order specified
and should cover all characters used in the template.
Optional emoji provider to use in this template. If not specified, defaults to
'noto'.OgTemplateRenderer
Configuration for the TemplateRenderer class. Defines available templates, global defaults, and lifecycle hooks.Map of template definitions to register, keyed by template ID
Shared parameter values applied to all templates. These values are merged with
user-provided parameters, with user values taking precedence.
Cache configuration for fonts and icons. When provided, enables LRU caching to
improve performance by reducing redundant network requests.
Hook called before rendering. Useful for logging, analytics, parameter
validation, authentication checks, and rate limiting.
Hook called after rendering. Useful for caching generated images, cleanup
operations, sending notifications, and updating metrics.
Font Configuration
OgFontConfig
Configuration for a font used in OG image templates. Fonts can be loaded from three sources (in priority order):- Pre-loaded binary data (via
dataproperty) - Remote URL (via
urlproperty) - Google Fonts API (automatic detection based on
name)
The font family name (e.g., ‘Inter’, ‘Roboto’, ‘Merriweather’)
Font weight (100-900)
Font style
URL to the font file (for custom/self-hosted fonts)
Pre-loaded font binary data
Font file format
OgFontFormat
Supported font file formats.woff: Web Open Font Format (modern, compressed)ttf: TrueType Font (legacy, larger file size)
Template Options
OgTemplateOptions
Props passed to template HTML rendering functions. Contains user-provided parameters and optional dimension overrides.Custom fonts to use in this template
Optional emoji provider to use in this template
Optional custom width in pixels
Optional custom height in pixels
Enable Right-to-Left text direction
Emoji Providers
OgEmojiProvider
Supported emoji providers for rendering emoji characters in OG images. Each provider offers a different visual style.twemoji
twemoji
Twitter’s emoji set - colorful, rounded style
fluent
fluent
Microsoft’s Fluent emoji - 3D style with color
fluentFlat
fluentFlat
Microsoft’s Fluent emoji - flat 2D style
noto
noto
Google’s Noto Color Emoji - current standard (default)
blobmoji
blobmoji
Google’s blob-style emoji - deprecated but still available
openmoji
openmoji
Open-source emoji with outlined style