Dynamic OG Images
Velocity automatically generates OG images for all pages using Satori.
How It Works
Section titled “How It Works”OG images are generated at build time for each page:
/og/[...slug].pngURL Patterns
Section titled “URL Patterns”| Page | OG Image URL |
|---|---|
| Homepage | /og/index.png |
| About | /og/about.png |
| Blog post | /og/blog/my-post.png |
Automatic Integration
Section titled “Automatic Integration”The SEO component automatically references these paths:
<!-- You don't need to specify this --><meta property="og:image" content="https://yoursite.com/og/about.png" />Custom OG Images
Section titled “Custom OG Images”Override for specific pages:
<SEO title="Special Page" image="/custom-og-image.png"/>Configuration
Section titled “Configuration”OG image settings are in src/lib/og.ts:
export const ogConfig = { width: 1200, height: 630, fonts: ['Outfit', 'JetBrains Mono'], brandColor: '#F94C10',};Template Customization
Section titled “Template Customization”Edit src/pages/og/[...slug].png.ts:
export async function GET({ params }) { const title = getPageTitle(params.slug);
const svg = await satori( { type: 'div', props: { children: [ // Your template JSX { type: 'h1', props: { children: title } }, ], style: { // Styles }, }, }, { width: 1200, height: 630, fonts: await loadFonts(), } );
return new Response(svgToPng(svg), { headers: { 'Content-Type': 'image/png' }, });}Troubleshooting
Section titled “Troubleshooting”Images Not Generating
Section titled “Images Not Generating”- Check that dimensions are valid (1200x630 recommended)
- Ensure fonts are available
- Check build logs for errors
Font Issues
Section titled “Font Issues”Fonts must be loaded as ArrayBuffers:
const fontData = await fetch(fontUrl).then(r => r.arrayBuffer());Slow Builds
Section titled “Slow Builds”OG generation can be slow for large sites. Consider:
- Caching generated images
- Using simpler templates
- Reducing font complexity