Open Graph fixes · Next.js
Fix missing Open Graph tags in Next.js
In Next.js the Open Graph tags live in app/blog/[slug]/page.tsx, which exports a metadata object whose openGraph block becomes the og:* tags. Below is the complete snippet plus the one-tag fix for each of the 10 core tags our scanner checks, so you can patch exactly what the scan flagged.
The fix
Add this to app/blog/[slug]/page.tsx
// app/blog/[slug]/page.tsx
export const metadata = {
title: 'Your page title',
description: 'A one or two sentence summary of this page.',
openGraph: {
title: 'Your page title',
description: 'A one or two sentence summary of this page.',
url: 'https://example.com/page',
type: 'website',
images: ['https://example.com/og.png'],
siteName: 'Your site name',
},
twitter: { card: 'summary_large_image' },
};- Open app/blog/[slug]/page.tsx in your Next.js project.
- Paste the snippet and replace the sample title, description, image and URL with your own.
- Deploy, then scan the live URL: the scanner re-checks all 10 tags and lists what is still missing.
One tag at a time
Fix a single missing tag in Next.js
title
export const metadata = {
title: 'Your page title',
};meta description
export const metadata = {
description: 'A one or two sentence summary of this page.',
};og:title
export const metadata = {
openGraph: { title: 'Your page title' },
};og:description
export const metadata = {
openGraph: { description: 'A one or two sentence summary of this page.' },
};og:image
export const metadata = {
openGraph: { images: ['https://example.com/og.png'] },
};og:url
export const metadata = {
openGraph: { url: 'https://example.com/page' },
};og:type
export const metadata = {
openGraph: { type: 'website' },
};og:site_name
export const metadata = {
openGraph: { siteName: 'Your site name' },
};twitter:card
export const metadata = {
twitter: { card: 'summary_large_image' },
};twitter:image
export const metadata = {
twitter: { images: ['https://example.com/og.png'] },
};Check the Next.js fix on a live URL
FAQ
Common questions
Where do Open Graph tags go in Next.js?
In app/blog/[slug]/page.tsx. The snippet exports a metadata object whose openGraph block becomes the og:* tags.
Which Open Graph tags does Next.js need?
At minimum og:title, og:description, og:image and og:url, plus twitter:card. The scanner checks 10 tags in total: title, meta description, og:title, og:description, og:image, og:url, og:type, og:site_name, twitter:card, twitter:image.
How do I confirm the Next.js fix worked?
Deploy, paste the live URL into the free scanner, and check that every tag above passes. The simulator then draws the card for 30 platforms.