Dynamic OG Images in Nuxt
Nuxt makes the tags easy: useSeoMeta gives you typed Open Graph and X fields with reactive values. The image is the harder part. You either make one per page by hand, generate them with a module, or point og:image at a hosted image URL.
This guide covers all three. It sets the tags with Nuxt's built-in composables, explains how the nuxt-og-image module (part of the Nuxt SEO project, not Nuxt core) generates images, and shows the alternative: one Unfurlkit URL per page, with nothing to render in your app.
Sources checked (21 Oct 2026): Nuxt docs, "SEO and Meta" (https://nuxt.com/docs/4.x/getting-started/seo-meta). Nuxt SEO docs for nuxt-og-image: introduction (https://nuxtseo.com/docs/og-image/getting-started/introduction), installation (https://nuxtseo.com/docs/og-image/getting-started/installation) and tutorial (https://nuxtseo.com/docs/og-image/getting-started/getting-familiar-with-nuxt-og-image).
Step 1: Set the tags with useSeoMeta
Nuxt's head management is powered by Unhead. For SEO and social tags, the docs recommend useSeoMeta. It takes an object with typed keys, so you can't accidentally write name where Open Graph needs property:
<script setup lang="ts">
useSeoMeta({
title: 'My Amazing Site',
ogTitle: 'My Amazing Site',
description: 'This is my amazing site, let me tell you all about it.',
ogDescription: 'This is my amazing site, let me tell you all about it.',
ogImage: 'https://unfurlkit.com/v1/basic.png?title=Hello%20world&theme=dark',
twitterCard: 'summary_large_image',
})
</script>
Every value can be reactive (a ref, a computed value or a getter), so per-page values from your data work as expected.
For site-wide defaults that never change (language, favicon, a default title), the docs suggest app.head in nuxt.config.ts. Note that app.head can't hold reactive data, so don't put per-page images there.
A blog post page
On a content page, load the post and pass its values in:
<!-- app/pages/blog/[slug].vue -->
<script setup lang="ts">
const route = useRoute()
const { data: post } = await useAsyncData(`post-${route.params.slug}`, () =>
$fetch(`/api/posts/${route.params.slug}`)
)
useSeoMeta({
title: () => post.value?.title,
ogTitle: () => post.value?.title,
description: () => post.value?.description,
ogDescription: () => post.value?.description,
ogImage: () => post.value?.image, // must be an absolute URL
twitterCard: 'summary_large_image',
})
</script>
/api/posts/... stands in for wherever your content comes from (a server route, Nuxt Content, a CMS).
Absolute URLs
Crawlers don't resolve relative image paths reliably. Make every og:image an absolute https:// URL. If you build it from your own domain, keep the site URL in runtime config rather than hard-coding it in many places.
Step 2 (module): Generate images with nuxt-og-image
nuxt-og-image is a Nuxt module from the Nuxt SEO project. If you already use @nuxtjs/seo, it's included. Per its docs (v6 at the time of writing):
- It renders OG images from Vue components, at build time or on demand.
- There are three renderers: Takumi (which the docs recommend), Satori, and Browser (full CSS via screenshots, prerender only).
- It requires Nuxt 4.6.1+ or Nuxt 5, and Node 22.22.3+, 24.15.0+ or 26+.
- It bundles Inter (weights 400 and 700) by default. Custom fonts are covered in its own guide.
- It does nothing until you configure it. You install a renderer with its CLI, for example
npx nuxt-og-image enable takumi. - For edge runtimes, the CLI installs WASM variants.
- Prerendering needs a site URL. Without one, a prerendered
og:imageis a relative path and the build logs a warning.
Defining an image
defineOgImage is a server-only composable. The tutorial starts with a built-in template:
<script lang="ts" setup>
defineOgImage('NuxtSeo.takumi', {
title: 'Hello OG Image',
description: 'Look at me in dark mode',
colorMode: 'dark',
})
</script>
You then make your own template by adding a component in an OgImage folder, for example components/OgImage/BlogPost.takumi.vue. The .takumi suffix picks the renderer, and props you pass to defineOgImage arrive as component props:
<script lang="ts" setup>
defineOgImage('BlogPost.takumi', { title: post.value?.title || 'My Blog' })
</script>
The module's docs make two points worth knowing before you ship:
- Community templates are for development only. For production you eject them into your project (
npx nuxt-og-image eject <Name>) or write your own. - Dynamic Tailwind classes built from props don't resolve to your theme. Write theme classes statically and use
:stylefor prop-driven values.
There's also a DevTools tab with a live playground, which needs the optional nuxtseo-devtools-host dev dependency.
The trade-offs
nuxt-og-image is a capable, well-documented option, and for many Nuxt sites it's the right one. What you take on:
- Rendering runs in your app. On demand, that's compute on your server or edge function for every uncached image. Prerendered, it adds build time per page.
- Runtime requirements. Recent Nuxt and Node versions, plus a renderer dependency (and WASM variants on edge).
- Templates are your code. You maintain the Vue components, fonts and any ejected templates.
- Caching is your job for on-demand images. Without it, a crawler storm means a render storm.
If you'd like images without any of that, use a hosted URL.
Step 2 (alternative): One URL with Unfurlkit
Instead of rendering, point ogImage at an Unfurlkit URL built from the page title:
<!-- app/pages/blog/[slug].vue -->
<script setup lang="ts">
const route = useRoute()
const { data: post } = await useAsyncData(`post-${route.params.slug}`, () =>
$fetch(`/api/posts/${route.params.slug}`)
)
const ogImage = computed(() =>
'https://unfurlkit.com/v1/basic.png?' +
new URLSearchParams({ title: post.value?.title || 'My Blog', theme: 'dark' }).toString()
)
useSeoMeta({
title: () => post.value?.title,
ogTitle: () => post.value?.title,
ogImage,
ogImageWidth: 1200,
ogImageHeight: 630,
twitterCard: 'summary_large_image',
})
</script>
title is required and must be non-empty, so keep a fallback such as your site name. The basic template also takes subtitle (up to 160 characters), theme (light or dark) and accent (6-digit hex without #). See the basic template.
Plans. Every image URL needs your key. A Free key gets 10 renders in total (no monthly reset), with a small "unfurlkit" watermark, and needs no card. Pro is $9/mo or $90/yr, with 10,000 renders a month, no watermark, and custom fonts (Inter, Roboto, Playfair Display, JetBrains Mono) and logo. Pro URLs add your public key k and a signature s.
Signing in Nuxt. The secret must never reach the browser. Keep it in a private runtime config key (not under public), sign in a server route, and return the finished URL with your post data:
// server/api/posts/[slug].get.ts
import { signedOgUrl } from '~~/server/utils/unfurlkit' // the Node snippet from our signing guide
export default defineEventHandler(async (event) => {
const post = await getPost(getRouterParam(event, 'slug')) // your data source
const { unfurlkitPublicKey, unfurlkitSecretKey } = useRuntimeConfig(event)
return {
...post,
image: signedOgUrl(
{ title: post.title || 'My Blog', theme: 'dark' },
unfurlkitPublicKey,
unfurlkitSecretKey,
),
}
})
The page then uses post.image as in Step 1. See Signing Pro URLs for the snippet.
A render is counted only when a unique image is generated and wasn't already cached. Shares and cache hits don't count. Over the limit, images keep rendering. On a signed Free key, images already made keep showing, and new ones get a plain version (your title on the basic card, with the small mark) that doesn't count. Upgrade to Pro for more renders. On Pro there's no hard stop and no overage charge, and we may contact you about your usage. Upgrade to Pro to remove watermarks from all your images. See pricing.
What changes:
- No renderer dependency, no WASM on edge, no Node version floor from a module.
- Nothing to prerender. Builds stay as fast as they are.
- Same pattern on your other sites, whatever they're built with.
What you give up: full design control. Unfurlkit's basic template is a fixed layout. If you need your own Vue-designed card, nuxt-og-image is the better fit.
Which option should you use?
| Situation | Best fit |
|---|---|
| A few pages, a designer-made image | A static file in public/ plus useSeoMeta |
| You want custom-designed, Vue-built cards and are on recent Nuxt | nuxt-og-image |
| Any Nuxt version, no rendering in your app, a clean standard card | Unfurlkit |
| You need right-to-left scripts today | nuxt-og-image with suitable fonts (Unfurlkit doesn't support RTL yet) |
Debugging checklist
- View source, not DevTools Elements. Crawlers see the server-rendered HTML. Search it for
og:image. - Check the image URL is absolute and opens on its own as an image.
- Prerendering with nuxt-og-image? Set your site URL, or you'll get relative image paths.
- SPA mode (
ssr: false)? Crawlers may not run your JavaScript, so tags set at runtime may never be seen. Prerender or server-render pages you want to share. - Unfurlkit 400? A missing or empty
title, or an invalid param (checkthemeandaccent). - Run the Free OG Image Checker to see how X, LinkedIn, Facebook, WhatsApp, Slack, Discord and iMessage will show the page.
More causes: OG image not showing.
FAQ
Which languages and scripts are supported? Right-to-left scripts such as Arabic and Hebrew aren't supported yet at launch.
useSeoMeta or useHead?
Both work. useSeoMeta is typed for SEO tags, which avoids name/property mistakes. useHead is more general.
Is nuxt-og-image an official Nuxt module?
It's part of the Nuxt SEO project and lives in the nuxt-modules GitHub organization, but it isn't part of Nuxt core. Check its docs for current support.
Do I need twitter:image too?
Setting twitterCard: 'summary_large_image' gets the large card. X is commonly reported to fall back to og:image, but we couldn't confirm that in current X docs, so setting twitterImage as well is the safe choice.
What size should the image be? 1200×630. Unfurlkit outputs exactly that. See OG image size.
Summary
Use useSeoMeta for the tags. For the image, nuxt-og-image gives you full design control at the cost of a renderer in your app, while an Unfurlkit URL gives you a standard card with nothing to run.
See Unfurlkit pricing · Check any page with the Free OG Image Checker.