Open Graph tags not working: how to fix link previews
Open Graph tags not working? Check for missing tags, relative image URLs, JavaScript-only markup and duplicates, then force a re-scrape after the fix.
By Crawlito · 9 min read
In short
- The Open Graph protocol lists four required tags: og:title, og:type, og:image and og:url. og:description is optional in the spec, but Facebook and LinkedIn both read it.
- Link-preview scrapers read the HTML your server sends. Facebook's documentation does not say its crawler runs JavaScript, so put the tags in the server response and confirm with curl.
- Facebook says Open Graph properties must be listed before the first 1 MB of a page or they are cut off, so keep the tags near the top of the head.
- Facebook caches images by URL and says a changed image needs a new URL; its Sharing Debugger or a Graph API scrape call forces a fresh scrape, but links already shared keep the old data.
- Open Graph controls share previews. It is separate from your title, meta description and JSON-LD, and none of it promises rankings or citations.
On this page
- What are Open Graph tags and who reads them?
- What is the minimum set of Open Graph tags?
- Why is my link preview wrong or empty?
- What size should the image be?
- How to test your tags
- How to force a re-scrape after the fix
- How is Open Graph different from your title, meta description and structured data?
- Frequently asked questions
- Check the HTML a crawler receives
If a shared link shows the wrong image, the wrong title or no preview at all, the cause is almost always one of five things: the tags are missing, the image URL is relative or unreachable, the tags are added by JavaScript after the page loads, two plugins print conflicting tags, or the platform is showing a cached copy of an older version. Fix the HTML first, then ask the platform to scrape the page again.
Everything below separates what the specifications and platform documentation say from what is not documented. Where a platform does not say, this post says so.
What are Open Graph tags and who reads them?
Open Graph is a protocol, published at ogp.me, that turns a web page into a described object using <meta> tags in the page's <head>. When someone pastes your link into a social network or messaging app, the app's scraper fetches the page, reads those tags and builds a preview card from them.
Each platform runs its own scraper and its own cache. Facebook's is called the Facebook Crawler and identifies itself as facebookexternalhit. LinkedIn reads Open Graph tags for its link cards. X uses its own twitter: tags and can fall back to Open Graph for some of them: check X's Cards markup reference for the current list instead of assuming. Other chat and social apps run their own scrapers and caches, and this post covers only the platforms whose documentation it could check.
Open Graph tags are not a documented factor in search rankings or in whether an AI assistant cites a page. They exist to control how a shared link looks.
What is the minimum set of Open Graph tags?
The Open Graph protocol says every page needs four properties: og:title, og:type, og:image and og:url. It lists og:description as optional metadata, described as a one to two sentence summary. Facebook's sharing documentation names og:url, og:title, og:description, og:image and fb:app_id as its basic tags, and recommends og:type and og:locale. Per Facebook, fb:app_id is needed for Facebook Insights, not for the preview itself.
A working baseline looks like this:
<head>
<meta property="og:title" content="Open Graph tags not working: how to fix link previews" />
<meta property="og:description" content="A short summary of what the page answers." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://www.example.com/blog/open-graph-fix" />
<meta property="og:image" content="https://www.example.com/images/og/open-graph-fix.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="Diagram of a link preview card" />
</head>Some details from the sources:
og:typetakes values such aswebsiteandarticle. Facebook says it defaults towebsitewhen absent.og:urlis the canonical URL and the permanent ID of the object. Facebook says it should not include session variables, user identifying parameters or counters, because likes and shares aggregate at that URL.og:image:width,og:image:height,og:image:typeandog:image:secure_urlare structured properties of the image. The protocol also says pages that specifyog:imageshould specifyog:image:alt, a description of what the image shows.- Each tag uses
propertyfor its name andcontentfor its value. The protocol's example markup also declaresprefix="og: https://ogp.me/ns#"on thehtmlelement.
Why is my link preview wrong or empty?
Work through these in order. Each one has a quick check, shown in the testing section below.
The tags are missing or in the wrong place
A template that never prints the tags, a page type that skips them, or a redirect that lands on a different page can all produce an empty or generic card. Facebook also says Open Graph properties need to be listed before the first 1 MB of a page, or they are cut off. If a huge inline script or style block sits ahead of your tags in the head, move the tags up.
The image URL is relative or unreachable
The protocol does not address relative URLs, and every example in it uses an absolute one. Facebook's FAQ says its debugger requires absolute URLs for og:url. Neither source says what a scraper does with a relative og:image, so do not depend on it. Use the full https:// URL.
The image must also be fetchable by a scraper, not just by your browser. Facebook says a white box usually means the image is no longer available, is too big or could not be fetched because of a temporary issue, and it advises keeping images under 8 MB. LinkedIn's help page says that if an image meets its requirements but still does not show, your site may be blocking its fetch. Check that your CDN, firewall or hotlink protection is not returning a 403 or a challenge page to scrapers. The same checks apply as for any crawler; how to see your page as an AI crawler with curl shows how to spot a challenge response.
The tags are added by JavaScript
A scraper that does not run JavaScript sees only what the server sends. Facebook's documentation does not say whether its crawler executes JavaScript, so treat server-rendered tags as the only safe option. In a client-side rendered app, a head that is filled in by a script after load can leave the scraper with a blank or generic card, and the same raw-versus-rendered gap hides page text from many crawlers. Raw HTML versus rendered HTML explains the difference, and React SPA fixes compares ways to ship real HTML per route. In Next.js, the metadata API generates head tags on the server; our Next.js post covers how, and you should still confirm the final response with curl.
Two sources print conflicting tags
Themes, SEO plugins and social plugins can each print their own set of Open Graph tags, which leaves two og:image or two og:title tags in one page. This is common on WordPress; the WordPress readiness post covers what SEO plugins change. The protocol says that for tags that accept several values, the first tag from the top is given preference in conflicts. It does not say how a scraper should resolve two competing values of a single-value tag such as og:title, so remove the duplicate rather than rely on order. Pick one source of tags and turn the other off.
The platform is showing an older, cached copy
Facebook says its crawler caches the metadata and refreshes it automatically every 30 days, so a fix can take that long to appear without a manual refresh. A CDN or page cache that still serves the old HTML has the same effect, so purge it first; stale CDN cache explains how to tell.
What size should the image be?
The platforms publish different requirements. These are the figures from their own pages at the time of writing:
| Platform | Documented guidance |
|---|---|
| Minimum 200 x 200 pixels; at least 1200 x 630 recommended; 600 x 315 or larger for the large link card; ratio close to 1.91:1; under 8 MB | |
| At least 1200 x 627 pixels; ratio 1.91:1 recommended; maximum 5 MB |
Facebook adds that images between 200 x 200 and 600 x 315 render as a small square, and that images are cached by URL. To replace an image, publish it at a new URL and keep the old one online, because shares that already exist can still reference it and show a white area if it disappears. Facebook also says images are cached asynchronously, so the image may not render the first time someone shares the link. Setting og:image:width and og:image:height, or scraping the URL in the Sharing Debugger first, avoids that. A 1200 x 630 image sits at about 1.9:1, so one file satisfies both platforms above.
For X, follow the tag and image rules in its Cards documentation, which this post did not verify.
How to test your tags
Test the raw response, not the browser. Fetch the page and list the Open Graph tags:
curl -s https://www.example.com/blog/open-graph-fix | grep -io '<meta[^>]*og:[^>]*>'This pattern is a quick screen. It can miss tags split across lines or ones that put content before property, so confirm odd results in the page source. Count the matches too: two og:image lines mean you have a duplicate.
Facebook documents a test user agent, so you can ask for the page the way its scraper does:
curl -s -A "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)" \
https://www.example.com/blog/open-graph-fix | grep -io '<meta[^>]*og:[^>]*>'Facebook says that if a page loads correctly with a mobile browser user agent but not with the Facebook one, the problem is user agent handling. A spoofed user agent comes from your own IP address, so a firewall that checks IP ranges can still treat the real crawler differently.
Then check the image itself:
curl -sI https://www.example.com/images/og/open-graph-fix.pngLook for a 200 status, an image/ content type and a size under the platform limits.
Finally, use the platform's own tools. Facebook's Sharing Debugger previews how your content will look when shared to Facebook and helps you debug issues with your Open Graph tags. LinkedIn provides a Post Inspector. Its help page does not describe how long LinkedIn caches previews, so treat any specific number you read elsewhere as unconfirmed.
How to force a re-scrape after the fix
Fix the HTML and purge your own caches first, because a scraper that re-fetches stale HTML gains nothing.
- Facebook: enter the URL in the Sharing Debugger and run it again. Facebook says the debugger triggers a fresh scrape. You can also send a POST request to
/?id={your_url}&scrape=truewith the URL percent-encoded, as Facebook's documentation describes. - Existing Facebook posts: Facebook says an updated
og:imageand other updated metadata apply only to new shares. For a post that already exists, its FAQ says to open the post menu and choose Refresh share attachment. - LinkedIn: run the URL through the Post Inspector, then check the result in a new post.
- Everything else: use the platform's own debugger if it has one. If it does not, a changed URL, such as a new query string, is a common workaround, but it creates a different URL, so it is not a documented fix.
Do not change og:url to get around caching. Facebook warns that changing the canonical URL, including moving to HTTPS, can make shares and likes appear to disappear, because they are tied to that URL.
How is Open Graph different from your title, meta description and structured data?
These are separate layers, and fixing one does not fix the others.
| Element | Main job |
|---|---|
<title> and meta description | The page's own label and summary, used by search results and browser tabs |
| Open Graph tags | The share preview card on platforms that read them |
| JSON-LD structured data | Machine-readable facts for search engines |
The protocol and Facebook's sharing pages describe <meta> tags, not JSON-LD, so adding schema.org markup will not repair a broken share card. In the other direction, an Open Graph description does not replace a good meta description. The two can say similar things, but write each for its own audience. The page titles and meta descriptions post covers the search side.
Frequently asked questions
Which Open Graph tags are required?
The Open Graph protocol requires og:title, og:type, og:image and og:url. Facebook also lists og:description and fb:app_id as basic tags and recommends adding og:type and og:locale.
Why does my link preview still show the old image after I changed it?
The scraper cached the earlier data. Facebook caches images by URL and refreshes metadata about every 30 days, so use a new image URL, then re-scrape in the Sharing Debugger. Links that were already shared keep their old data until you refresh the share attachment.
Can I set Open Graph tags with JavaScript?
It is risky. Facebook's documentation does not say its crawler runs JavaScript, so tags added only in the browser may never be seen. Render them in the server's HTML and check with curl.
Do Open Graph tags help rankings or AI citations?
No documentation says so. They control how a shared link looks. Whether a page ranks or is cited depends on factors outside this markup.
Does the og:image have to be an absolute URL?
Use an absolute URL. The protocol's examples all use one, and Facebook requires absolute URLs for og:url, but neither source states what happens to a relative og:image.
Check the HTML a crawler receives
The free check reads one page the way AI crawlers do, with no account needed, including whether the main text is in the raw HTML. It is not a link-preview tester, so use the Sharing Debugger or Post Inspector for the share card itself. If a template problem spans many pages, an audit checks up to 500 pages and returns evidence and prioritized fixes.
Filed under Structure and schema. Topics: metadata, html, troubleshooting, rendering