Short answer: put og:title, og:type, og:url and an og:image with a full https:// URL in the HTML your server sends, plus <meta name="twitter:card" content="summary_large_image"> for a big card on X. Most blank previews come from a relative image path, an image the crawler can't reach, or tags that only appear after JavaScript runs.
1. The tags to copy
Paste this into <head> and change the values. Every URL must be absolute.
<meta property="og:title" content="My App: what it does in a few words">
<meta property="og:type" content="website">
<meta property="og:url" content="https://myapp.com/">
<meta property="og:image" content="https://myapp.com/og.png">
<meta property="og:image:alt" content="What the image shows">
<meta property="og:description" content="One or two sentences about this page.">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="My App: what it does in a few words">
<meta name="twitter:description" content="One or two sentences about this page.">
<meta name="twitter:image" content="https://myapp.com/og.png">
Why these: ogp.me lists og:title, og:type, og:image and og:url as "the four required properties for every page", and says a page with an og:image "should specify og:image:alt". X's docs mark twitter:card (set to summary_large_image) and twitter:title as required for the large card.
2. The image rules
- X: "an aspect ratio of 2:1 with minimum dimensions of 300x157 or maximum of 4096x4096 pixels", "less than 5MB", and "JPG, PNG, WEBP and GIF formats are supported". Only the first frame of an animated GIF is used. A 1200x600 PNG or JPG is a safe pick.
- X also says not to use "a generic image such as your website logo". Make one image that says what the page is.
- Open Graph: image values are URLs, and ogp.me defines a URL as one using
http://orhttps://. A path like/og.pngis not one, so write the full address. - Discord and others: we didn't find an official page for site owners listing which tags Discord reads (as of 2026-11-09), so we won't guess. The standard tags above are the ones to set.
3. Why the card is still blank
- Relative image path.
content="/og.png"instead ofhttps://myapp.com/og.png. In Next.js, setmetadataBaseso relative paths inmetadatabecome absolute. - The crawler can't fetch the image or the page. Anything behind a login, a preview-only URL, or Vercel deployment protection is invisible to it. Open the image URL in a private window: you should see the image, not a login page.
- Tags added by JavaScript. Slack says its classic unfurl "crawls the URL, looks for common OpenGraph and X (formerly known as Twitter) Card metadata". If your Vite/Lovable/Bolt app sets tags in React after load, they may not be in the HTML that gets crawled. Put them in
index.html(or use your framework's server-side metadata). - Slack only: Slack never unfurls a link whose label is part of the URL, such as
example.comlinking tohttp://example.com. Paste the full URL. - Old post, old card. Platforms cache previews. After a fix, test with a fresh post or a fresh URL rather than the one you already shared.
4. Framework snippets
Next.js (App Router)
// app/layout.tsx
export const metadata = {
metadataBase: new URL('https://myapp.com'),
title: 'My App',
description: 'One or two sentences about this page.',
openGraph: { type: 'website', url: '/', images: [{ url: '/og.png', width: 1200, height: 600, alt: 'What the image shows' }] },
twitter: { card: 'summary_large_image' },
};
Next.js 16: four things that blank the card
- A page's
openGraphreplaces the layout's, it doesn't merge. Next.js merges metadata from each segment shallowly, so ifapp/blog/[slug]/page.tsxsetsopenGraph: { title }, theimagesyou set inapp/layout.tsxare gone for that page. Repeatimagesin the page'sopenGraph, or read them fromparentingenerateMetadata. - Relative paths need
metadataBase. The docs say a relative path in a URL-based field withoutmetadataBasecauses a build error. Set it once in the root layout; an absolute URL in a field ignores it. - Easiest image: a file. Drop
opengraph-image.png(and optionallyopengraph-image.alt.txt) into a route folder and Next.js writes theog:image, type, width and height tags for you. Same fortwitter-image. The build fails iftwitter-imageis over 5MB oropengraph-imageis over 8MB. If you generate the image in code withImageResponse, note that in Next.js 16paramsis a promise:const { slug } = await params. - Streamed metadata. With
generateMetadata, Next.js can send the page first and append the tags to<body>later. For bots it detects as "HTML-limited" (the docs namefacebookexternalhit) it waits and puts the tags in<head>. If a preview bot you care about still shows a blank card, test with its user agent (below) and, if needed, sethtmlLimitedBotsinnext.config;htmlLimitedBots: /.*/turns streaming metadata off.
// app/blog/[slug]/page.tsx: keep the layout's image when you override openGraph
import type { Metadata, ResolvingMetadata } from 'next'
export async function generateMetadata(
{ params }: { params: Promise<{ slug: string }> },
parent: ResolvingMetadata
): Promise<Metadata> {
const { slug } = await params
const previousImages = (await parent).openGraph?.images || []
return {
title: `Post ${slug}`,
openGraph: { title: `Post ${slug}`, images: previousImages },
}
}
Vite, Lovable, Bolt or plain HTML
Put the tags from step 1 directly in index.html, and put og.png in public/ so it is served at https://yourdomain/og.png.
5. Test before you post
# Are the tags in the HTML the server sends?
curl -sL https://myapp.com/ | grep -iE 'og:|twitter:'
# Next.js with generateMetadata: what does a preview bot get?
curl -sL -A 'facebookexternalhit/1.1' https://myapp.com/ | grep -iE 'og:|twitter:'
# Does the image load for a logged-out visitor, as an image?
curl -sIL https://myapp.com/og.png | grep -iE '^HTTP|content-type|content-length'
You want 200, an image/ content type, and a size under 5MB. Then run a free ShipCheck scan: it flags missing title, description, viewport and Open Graph tags, and now also fetches your og:image to confirm it is an absolute URL that loads as an image under 5MB, alongside headers, leaked keys and speed.