Open Graph tags and og:image: how to set them up
Open Graph tags tell social and chat apps what title, description and image to show when someone shares your page. Add them to the server HTML with a full image URL, and use a 1200 × 630 image. If a preview still looks wrong, the app has probably cached an old version.
What Open Graph tags do
When someone pastes a link, the app fetches the page and reads its og: tags to build a card. Without them, it has to guess, and you may get the wrong image or no card at all.
They're for sharing, not search rankings, but they decide how your page looks wherever it's passed around. The property attribute is part of the format, so use it rather than name.
The tags you need
The Open Graph protocol requires four: og:title, og:type, og:image and og:url. A description and image details are optional but worth adding.
<meta property="og:title" content="Blue widgets for small workshops">
<meta property="og:description" content="Sizes, prices and delivery for our blue widget range.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://example.com/widgets/blue">
<meta property="og:image" content="https://example.com/images/blue-widgets.png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="A row of blue widgets on a workbench">
<meta name="twitter:card" content="summary_large_image">
og:urlshould be the page's canonical URL.og:image:widthandog:image:heightlet Facebook show the image before it's been downloaded.twitter:cardsets the X card layout.summary_large_imagegives the large image version.
The right og:image
Meta's sharing guidance is a good default for other apps too:
| Setting | Value |
|---|---|
| Best size | At least 1200 × 630 px |
| Aspect ratio | 1.91:1, so nothing gets cropped |
| Smallest for a large preview | 600 × 315 px |
| Absolute minimum | 200 × 200 px |
| Largest file on Facebook | 8 MB, though a much smaller file is safer for other apps |
Keep important text away from the edges, as some apps crop the image or show it small.
How to check them
1Check the server HTML 30 seconds
Many sharing bots don't run JavaScript, so the tags must be in the HTML the server sends:
curl -s https://example.com/page | grep -iE 'property="og:|name="twitter:'
2Check the rendered page 30 seconds
Open DevTools (F12), go to the Console and paste this. A tag that shows here but not in step 1 was added by JavaScript.
// Lists the social tags on the rendered page
document.querySelectorAll('meta[property^="og:" i], meta[name^="twitter:" i]')
.forEach((tag) => console.log(tag.getAttribute('property') || tag.name, '=', tag.content));
3Ask the platform 1 minute
Paste the URL into Meta's Sharing Debugger. It shows what Facebook sees and lets you scrape the page again.
Why the preview is wrong
- The old preview is cached. Facebook caches images by URL. Give a new image a new URL, keep the old one in place, then scrape again. Existing shares keep the old preview until they're refreshed.
- The tags are added by JavaScript. Move them to the server HTML.
- The image URL is relative. Use the full
https://address. - The image can't be fetched. It may return an error, sit behind a login, or be blocked by robots.txt or bot protection.
- The tags are outside the head. A stray element can end the head early.
- There are two sets of tags. A theme and a plugin may each add their own.
On Shopify, WordPress and Next.js
- Shopify: set the homepage's social sharing image under Online Store > Preferences. Other pages usually depend on the theme, so check its head code.
- WordPress: core doesn't add Open Graph tags, so they usually come from an SEO plugin. If you see duplicates, check the theme as well.
- Next.js: set
openGraphin the metadata, or add anopengraph-imagefile. Image URLs must be absolute, so setmetadataBase. Nested fields set on a page replace the wholeopenGraphobject from its layout. Next.js serves metadata in the head to bots that can't run JavaScript.
How crawlers report this
Screaming Frog has a Social section for these. Sitebulb's public hints library doesn't list an equivalent.
| Screaming Frog | What it means |
|---|---|
| Social: Missing OG Tags | The page has no Open Graph tags. |
| Social: Incomplete OG Tags | Some expected tags are missing. |
| Social: Relative OG Image URL | The image address isn't a full URL. |
| Social: Non-200 OG Image URL | The image doesn't load. |
| Social: OG Image Incorrect Size or Ratio | The image may be cropped or shown small. |
| Social: OG Tags Outside <head> | The tags sit in the body and may be missed. |
| Social: Multiple OG Tags | A tag appears more than once. |
| Social: Missing X Cards | The page has no X card tags. |
Launching a page?
Preview any page before it's shared
SEOSnip reads the social tags on the page you're on. You get:
- Every Open Graph and X card tag in the Elements tab, with missing recommended values listed
- A ticket for incomplete tags, with the page's details attached
- Open Graph and X card previews on the ticket
- A saved copy of the image, with its size, so the ticket shows what was live when you raised it