October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Add Open Graph Images in Nuxt 4 (and Nuxt 3)

Use Nuxt’s useSeoMeta composable to set a public og:image URL, share a default across routes, or derive an image from page data.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set a publicly accessible, absolute image URL with Nuxt’s useSeoMeta composable. For example, useSeoMeta({ ogImage: 'https://example.com/og-image.png' }) outputs the Open Graph image metadata used by link previews. Put shared defaults in a common location and override them with route-specific data when needed; make sure the metadata is present in the initial server-rendered HTML and the image URL works on your deployed site.

Set a shared Open Graph image

For a single image used across your site, call useSeoMeta in a shared component such as app.vue. You can also set it in a page when the image should apply only to that route. The following Nuxt 4 example sets an image along with the other common sharing fields:

As an Amazon Associate I earn from qualifying purchases.

<script setup lang="ts">
useSeoMeta({
  ogTitle: 'My page title',
  ogDescription: 'A short description of this page.',
  ogImage: 'https://example.com/og-image.png',
  twitterCard: 'summary_large_image',
})
</script>

Replace the example URL with the public URL of your own image. Nuxt maps the ogImage key to the Open Graph image metadata. Nuxt recommends useSeoMeta for common SEO fields because its typed keys help prevent mistakes such as confusing a name attribute with a property attribute. See the Nuxt 4 useSeoMeta documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put a static image in the public directory

For a file that does not need to be generated or imported through your build, put it in Nuxt’s public/ directory and reference its deployed, absolute URL in the metadata. Nuxt serves public assets from the site root; for example, a file named og-image.png can be referenced at https://example.com/og-image.png when deployed at that domain. Check the URL on the production site, not just in development. Nuxt’s public directory documentation describes this directory.

Choose where metadata belongs

Use one clear owner for each metadata field so that shared defaults and page-level overrides are predictable.

  • One image for the whole site: set it in a shared component such as app.vue, or use static defaults in app.head in nuxt.config.ts.
  • Different image on selected pages: keep a shared default, then set ogImage in the relevant page with useSeoMeta.
  • Metadata derived from page data: use the page’s data and a reactive getter where necessary, ensuring the value is ready for initial server rendering.
  • Broader head management: use useHead when you need general head customization beyond common SEO fields.

Nuxt documents app.head as suitable for static defaults; it does not support reactive data. Avoid independently setting the same field in multiple places with useHead and useSeoMeta unless you have verified which value wins in the rendered output. Nuxt’s SEO and Meta guide covers these approaches.

Use a page-specific image from fetched data

If each page has its own image URL, derive the metadata from that page’s data. Nuxt’s useSeoMeta supports getter syntax for reactive values:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const imageUrl = computed(() => page.value?.socialImage ?? 'https://example.com/default-og.png')
useSeoMeta({
  ogImage: () => imageUrl.value,
})

Here, page represents the page data in your application. Replace it with the data source used by your route. The fallback ensures there is still an image URL if the page has no custom social image.

Search and social crawlers may inspect the HTML returned for the initial page rather than wait for client-side code to update it. Nuxt notes that SEO metadata often does not need reactivity because bots primarily scan the initial page load. When metadata depends on fetched data, make that data available during server rendering where feasible, and inspect the actual rendered HTML to confirm the final og:image value is present.

When to generate images instead of using a static file

A static image URL is enough for many sites. Consider a generator if many routes need distinct branded title cards or if each preview should include page-specific text. The Nuxt OG Image module can create og:image output using templates or Vue components; its listing also describes a Nuxt DevTools preview, rendering through Satori or Takumi, browser prerendering for complex templates, and screenshots of pages. It is optional, not required to set a conventional image URL. The module listing showed version 6.10.1 in the available source material; module versions and capabilities can change.

To add it, run the installation command from the Nuxt OG Image module listing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npx nuxi@latest module add og-image

Use the module when its generated-image workflow fits your site; for a single shared asset, a public file and useSeoMeta are simpler.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the rendered page and troubleshoot previews

  1. Inspect the deployed page’s HTML. Confirm it contains an og:image tag with the intended URL and that the value is not empty or stale.
  2. Open the image URL independently. It should resolve on the production domain and be fetchable without a local development server or browser-only state.
  3. Check route data timing. If a page-specific value appears only after client-side rendering, move the relevant data and metadata into the initial server-rendered path where practical.
  4. Review duplicate head declarations. If multiple composables or defaults set the same field, simplify ownership and inspect which tag Nuxt ultimately renders.
  5. Use the target platform’s sharing debugger. A correct tag does not guarantee that every platform displays an identical preview. The Nuxt OG Image listing recommends checking previews with social sharing debuggers.

Common symptoms and fixes

Symptom Likely cause What to check
No image tag in the initial HTML The metadata is set only after client-side rendering, or the composable is not in the route’s rendering path. Use useSeoMeta in the page or a shared component and verify the server-rendered output.
The tag exists, but the image cannot be loaded The URL is relative, only works in development, or is otherwise inaccessible to a remote crawler. Use the deployed absolute URL and open it independently.
A route shows the wrong image A shared default, page-level value, or another head declaration is overriding the intended value. Assign each field a clear owner and inspect the final rendered tag for that route.
Different platforms show different previews Platforms may process previews differently; a valid tag alone does not ensure identical display. Test with the relevant platform’s debugger. Do not assume one platform’s result proves another’s behavior.

Exact current platform image dimensions, supported formats, and cache behavior are not established here, so do not treat a single dimension or preview test as a universal guarantee.

Nuxt 3 compatibility

The same general ogImage approach is documented in Nuxt’s versioned Nuxt 3 SEO guide: Nuxt 3 SEO and Meta. That versioned documentation identifies Nuxt 3.21.11, and Nuxt states that Nuxt 3 reached end of life on 31 July 2026. For a new implementation, use the current Nuxt 4 documentation and confirm version-specific behavior against the documentation for the version your project runs.

Or skip the browser setup

If you need a screenshot of a page to use as an asset, ScreenshotNeo can return an image or PDF with one GET request. It is a screenshot API and MCP server for developers. Its consent handling accepts cookie banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, with the result indicated by X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, this cURL request captures a page as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for the API options and response details. A screenshot of a page is not a substitute for setting the page’s intended Open Graph metadata; use it when a captured visual is the asset you want to publish.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.