Guide
Nuxt Open Graph image
In Nuxt you set the share image with useSeoMeta, or generate one per page with the Nuxt OG Image module. Either way, three things decide whether apps show it: the URL is absolute, the page is server-rendered or prerendered, and the served HTML has exactly one og:image.
A static image with useSeoMeta
Nuxt's SEO and meta guide and the useSeoMeta reference use the same shape: a flat object with typed keys for each meta tag.
<!-- app/app.vue: the site-wide default -->
<script setup lang="ts">
useSeoMeta({
ogImage: 'https://www.example.com/og/default.png',
twitterCard: 'summary_large_image',
})
</script>
Call it again in a page component to give that page its own title, description, and image. The page's values replace the defaults from app.vue.
<!-- app/pages/blog/[slug].vue -->
<script setup lang="ts">
const { data: post } = await useFetch(`/api/posts/${useRoute().params.slug}`)
useSeoMeta({
title: () => post.value?.title,
ogTitle: () => post.value?.title,
description: () => post.value?.summary,
ogDescription: () => post.value?.summary,
ogImage: () => post.value?.image,
})
</script>
The reference uses the getter form (() => value) for values that change, and shows wrapping static tags in if (import.meta.server) when they never need to update in the browser.
Use an absolute URL
useSeoMeta writes the string you pass. Every example in Nuxt's docs passes a full https:// URL. If you pass /og/default.png, that is what the tag says, and several apps drop a relative image. Build the URL from a runtime config value, such as useRuntimeConfig().public.siteUrl, so a preview deploy does not leak its host into production. Absolute og:image URL explains which apps fail on a relative path.
Keep server rendering on
Link preview bots read the HTML the server sends. They do not run your JavaScript. Nuxt's rendering guide shows client-side only rendering with ssr: false in nuxt.config.ts, and the same switch as a route rule for part of a site. On those pages the server sends a near-empty page, and useSeoMeta runs only in the browser, after the bot has gone.
Universal rendering (the default) or prerendering puts the tags in the first response. If one section must stay client-only, keep it away from the pages people share. JavaScript and SPA previews covers the general problem.
Generated images with Nuxt OG Image
The Nuxt OG Image module renders an image from a Vue template, at build time or on request. Its walkthrough starts with one call in a page:
<script setup lang="ts">
defineOgImage('NuxtSeo.takumi')
</script>
That uses the built-in NuxtSeo template with the Takumi renderer. Your own templates go in components/OgImage/, and the module registers each one automatically.
The install guide states the rule that breaks most setups: OG images must be served with absolute URLs, and a prerendered site needs a Site URL. Without one, a prerendered og:image is a relative path and the build logs a warning.
// nuxt.config.ts
export default defineNuxtConfig({
site: { url: 'https://www.example.com', name: 'Example' },
})
The install guide also accepts NUXT_SITE_URL as an environment variable. Do not also set ogImage in useSeoMeta on the same page. Two og:image tags let each app pick a different one.
Read the served HTML
Vue DevTools and the Elements panel show the DOM after hydration, which can include tags the server never sent. Read what a bot gets instead:
curl -s https://www.example.com/blog/my-post | grep -E 'og:image|twitter:'
nuxt dev serves on localhost, which no app can fetch. Check a deployed or preview URL, then paste it into the form above to see each app's card.
Checklist
ogImageis an absolutehttps://URL on the production host.- Shared pages are server-rendered or prerendered, not
ssr: false. - With Nuxt OG Image,
site.urlorNUXT_SITE_URLis set. - The served HTML has one
og:imageandtwitter:cardissummary_large_image. - After a change, apps that cached the old card get a refresh: see Clear Open Graph cache.
Next.js and Astro are in OG tags by framework. Docusaurus has its own guide: Docusaurus Open Graph image.
FAQ
How do I set og:image in Nuxt?
useSeoMeta({ ogImage: 'https://…', twitterCard: 'summary_large_image' }) in app.vue for a default, or in a page for that page. Pass an absolute URL; Nuxt prints what you give it.
Why don't previews show my image?
Read the served HTML with curl. If the tag is missing there, the page is client-rendered (ssr: false) and bots never see it.
Does Nuxt OG Image need a site URL?
Yes. Set site.url in nuxt.config.ts or NUXT_SITE_URL. Without it a prerendered og:image is relative.
What does a CardScope check cost?
A free check shows previews for X, LinkedIn, Slack, Discord, iMessage, Bluesky, Threads, Mastodon, WhatsApp, Telegram, and Microsoft Teams, plus the fix checklist. Pro is $19 once via Stripe Checkout, not a subscription: unlimited checks, a 50-page site audit with a CSV, share links, and PNG export. No account. A sample report shows a full result. A free audit checks the first 3 pages of a site and lists the rest. We parse HTML in memory and discard it — we do not store the page.