OG Images in Ghost
Ghost handles social previews better than most platforms out of the box. Every post gets Open Graph and X card tags, and the editor has per-post override fields. What Ghost doesn't do is generate an image. If a post has no feature image, or the feature image is a photo that crops badly into a 1.91:1 card, the link preview suffers.
This guide covers how Ghost outputs these tags, the settings you can use without writing code, what you can and can't do in a theme, and how to give every post a generated card using a hosted Unfurlkit URL.
Sources checked (Oct 2026): Ghost theme docs for
{{ghost_head}}(https://ghost.org/docs/themes/helpers/ghost_head_foot/), Ghost Help on post settings (https://ghost.org/help/post-settings/) and site setup (https://ghost.org/help/site-setup/), and the Ghost Admin API docs (https://docs.ghost.org/admin-api).
How Ghost outputs Open Graph tags
According to Ghost's theme docs, {{ghost_head}} belongs just before </head> in your theme's default.hbs, and it outputs, among other things:
- the meta description
- Schema.org structured data as JSON-LD
- structured data tags for Facebook Open Graph and Twitter Cards
- RSS links
- anything added in Code Injection, either site-wide or per post
So if your theme includes {{ghost_head}} (all official themes do), you already have og: and twitter: tags. If a custom theme is missing it, you get no social tags at all. That's the first thing to check on a broken Ghost site.
{{!-- default.hbs --}}
<!DOCTYPE html>
<html lang="{{@site.locale}}">
<head>
<meta charset="utf-8" />
<title>{{meta_title}}</title>
{{ghost_head}}
</head>
<body class="{{body_class}}">
{{{body}}}
{{ghost_foot}}
</body>
</html>
Built-in settings (no code)
Per post
In the post editor's settings panel, Ghost offers:
- Feature image. For most posts this becomes the social image.
- Facebook card. A custom image, title and description for Open Graph. Ghost Help also notes that Facebook caches Open Graph data when a post is published, and points to the Facebook Sharing Debugger to update it.
- X card. Custom data for X. If it isn't set, Ghost uses the post's custom meta data.
Ghost Help documents these fields, and Ghost forum answers from community experts describe the image fallback as: Facebook card image, then the feature image, then site-level metadata images. The exact order isn't spelled out on a single official page, so check your page source rather than relying on it.
Site-wide
Under Settings → General → Meta data you can set site-wide meta data, an X card, and a Facebook card with custom image, title and description. These cover the homepage and act as the publication default.
Where this falls short
All of these fields take an uploaded image. Someone still has to design a 1200×630 card for each post, or accept that the feature image (often a photo) is the social image. For a newsletter or blog that publishes often, that's the gap.
The DIY options in Ghost, honestly
Ghost is a hosted Node app with a Handlebars theme layer. That shapes what you can do.
1. Make images by hand (or with a design template)
Design a template once in any design tool and export a card per post. Upload it as the Facebook card or X card image. This works on any Ghost site, Ghost(Pro) included. The cost is time per post.
2. Add tags in the theme or Code Injection, but avoid duplicates
You can print your own og:image in default.hbs or via Code Injection. But {{ghost_head}} already prints og:image, so you'd end up with two. With duplicate tags, platforms may pick either one. Ghost's theme docs don't document a switch that turns off just the image tag. Editing theme output to hide Ghost's tags isn't something the docs cover, so we don't recommend it.
3. Run a generator next to Ghost
If you self-host, you can run a small service (for example Node with Satori or @vercel/og) that renders a card per post. Then set each post's og_image to that service's URL using the Admin API (see below). This gives you full control, but you now operate a second service: fonts, caching, uptime.
4. Set og_image programmatically with the Admin API
Ghost's Admin API exposes post fields including og_image and twitter_image, and per the docs, all writable fields of a post can be updated with PUT /admin/posts/{id}/. updated_at is required for collision detection, so fetch the post first. Ghost publishes an official JavaScript client, @tryghost/admin-api, which handles the JWT for you.
Replace your-site.com with your own site.
// set-og-images.mjs (run locally or in CI; keep the Admin API key secret)
import GhostAdminAPI from '@tryghost/admin-api';
const api = new GhostAdminAPI({
url: process.env.GHOST_URL, // e.g. https://blog.your-site.com
key: process.env.GHOST_ADMIN_API_KEY, // from Settings → Integrations
version: 'v5.0', // TODO: confirm current version string in Ghost docs
});
const ogUrl = (title) =>
'https://unfurlkit.com/v1/basic.png?' +
new URLSearchParams({ title: title || 'My Publication', theme: 'dark' }).toString();
const posts = await api.posts.browse({ limit: 'all', fields: 'id,title,updated_at,og_image' });
for (const post of posts) {
if (post.og_image) continue; // respect images set by hand
const image = ogUrl(post.title);
await api.posts.edit({
id: post.id,
updated_at: post.updated_at,
og_image: image,
twitter_image: image,
});
console.log('Updated', post.title);
}
Two caveats:
- We haven't confirmed in Ghost's docs that
og_imageaccepts an external URL rather than an image uploaded to Ghost. Test on one draft post and check the renderedog:imagebefore running this across your site. - If a post title changes later, run the script again (or trigger it from a Ghost webhook) so the image matches the new title.
The one-URL option with Unfurlkit
Unfurlkit replaces "run a generator next to Ghost" with a URL. You don't need a design tool, an extra service, or font files. The script above is the integration: it writes an Unfurlkit URL into each post's og_image and twitter_image, and {{ghost_head}} prints it as usual, so there are no duplicate tags.
Tip: Remove the platform's own og:image setting first, so you don't end up with two. If you paste tags with Code Injection instead of running the script, clear the post's Facebook card / X card image and check the published post for a single
og:image.
The basic template accepts:
| Param | Notes |
|---|---|
title |
Required and non-empty. Trimmed to 120 characters. |
subtitle |
Optional. Trimmed to 160 characters. Your publication name works well here. |
theme |
dark (default) or light |
accent |
6-digit hex without #, default 7c3aed |
Unknown parameters return a 400, so stick to these.
<!-- What {{ghost_head}} ends up printing -->
<meta property="og:image" content="https://unfurlkit.com/v1/basic.png?title=How%20we%20grew%20our%20newsletter&theme=dark" />
Plans. Every image URL needs your key. A Free key gets 10 renders in total (no monthly reset), with a small "unfurlkit" watermark, and needs no card. Pro is $9/mo or $90/yr, with 10,000 renders a month, no watermark, and custom fonts (Inter, Roboto, Playfair Display, JetBrains Mono) and logo. Pro URLs carry your public key (k) and a signature (s) computed with your secret key. Because the script runs on your machine or in CI, you can sign there and the secret never reaches the browser. See Signing Pro URLs for the Node and Python snippets.
A render is counted only when a unique image is generated and wasn't already cached. Shares and cache hits don't count. Over the limit, images keep rendering. On a signed Free key, images already made keep showing, and new ones get a plain version (your title on the basic card, with the small mark) that doesn't count. Upgrade to Pro for more renders. Upgrade to Pro to remove watermarks from all your images.
Why this fits Ghost
- Works on Ghost(Pro) and self-hosted alike. You don't need custom server code.
- Uses Ghost's own fields, so
{{ghost_head}}stays the single source of tags. - Images you set by hand still win, because the script skips posts that already have
og_image.
Which option should you use?
| Situation | Use |
|---|---|
| Feature images already look good as cards | Do nothing; Ghost handles it |
| A few important posts | Upload a Facebook card / X card image by hand |
| Self-hosted, want full control | Your own generator + Admin API |
| Many posts, no designer, any hosting | Unfurlkit URL via Admin API |
Debugging checklist
- Is
{{ghost_head}}indefault.hbs? Without it, there are no social tags. - View source on the live post. Is there exactly one
og:image? A second one usually comes from Code Injection or hand-added theme tags. - Which image won? If it's an old image, check the post's Facebook card and X card fields and the site-wide Meta data settings. Forgotten uploads there override the feature image.
- Open the image URL directly. It should return 200 with an image type. With Unfurlkit, a
400means an invalid parameter. - Image size. Large original feature images can exceed platform limits. Meta documents an 8 MB maximum for Facebook link shares, LinkedIn 5 MB, and WhatsApp recommends under 600 KB. See our OG image size guide.
- Refresh platform caches with Meta's Sharing Debugger (https://developers.facebook.com/tools/debug/), which Ghost Help itself recommends, and LinkedIn's Post Inspector (https://www.linkedin.com/post-inspector/).
- Run the URL through the Free OG Image Checker for previews on X, LinkedIn, Facebook, WhatsApp, Slack, Discord, and iMessage. We don't store the URLs you check.
FAQ
Which languages and scripts are supported? Right-to-left scripts such as Arabic and Hebrew aren't supported yet at launch.
Can I use a different image for X and Facebook?
Yes. That's what the separate X card and Facebook card fields are for, and the Admin API exposes og_image and twitter_image separately.
Does the newsletter use the same image?
Ghost emails use the post content and feature image. The og_image field affects social sharing, not the email template.
Will the script overwrite images my team uploaded?
Not as written. It skips any post where og_image is already set.
What about pages and tags? Ghost pages work like posts in the Admin API. Tag and author archive pages use their own meta fields.
Summary
Ghost already outputs Open Graph and X card tags through {{ghost_head}} and gives you per-post override fields. What's missing is an image for every post. You can design them by hand, run your own generator, or write an Unfurlkit URL into each post's og_image with the Admin API and let Ghost do the rest.
See Unfurlkit pricing · Check any page with the Free OG Image Checker.