BuiltByBadge

How-to

What Open Graph tags does a website need for good link previews?

A page needs og:title, og:type, og:image and og:url, plus og:description, og:site_name and twitter:card set to summary_large_image. Make the image 1200 by 630 pixels, PNG or JPG, under 5 MB, and link it with an absolute URL. X falls back to your Open Graph tags for everything else, and Meta renders the first share faster if you add og:image:width and og:image:height.

What are Open Graph tags?

Open Graph tags are <meta> elements in a page's <head> that tell other apps how to show your link when someone shares it. When you paste a URL into a post, a chat or a DM, the platform sends a crawler to fetch the page, reads these tags, and builds the card: the title, a short description and a large image. Without them, the platform guesses, and the guess is usually your logo cropped badly or no image at all.

The format comes from the Open Graph protocol, originally created at Facebook and now read by most apps that unfurl links. X has its own twitter: tags, but as covered below, it falls back to the Open Graph ones for almost everything.

For a maker, this matters more than it sounds. Most early traffic to a side project arrives through shared links: a launch post, a Show HN comment, a friend dropping the URL in a group chat. The card is the first impression, and it is one of the few parts of a launch you fully control.

Which Open Graph tags does a page actually need?

The Open Graph protocol lists four required properties: og:title, og:type, og:image and og:url. It calls og:description and og:site_name optional but generally recommended. Meta's webmaster sharing guide lists its basic set as og:url, og:title, og:description, og:image and fb:app_id, and says og:type defaults to "website" when you leave it out. You can skip fb:app_id unless you use Facebook's developer tools for insights.

Here is a complete head for a small product's home page. Copy it, swap the values, and you are covered on every major platform:

<head>
  <title>Pagewise: shared notes for small teams</title>
  <meta name="description" content="Pagewise keeps your team's notes in one fast, searchable place.">
  <link rel="canonical" href="https://pagewise.example/">

  <meta property="og:title" content="Pagewise: shared notes for small teams">
  <meta property="og:description" content="Shared notes that load instantly and search in one keystroke.">
  <meta property="og:type" content="website">
  <meta property="og:url" content="https://pagewise.example/">
  <meta property="og:site_name" content="Pagewise">
  <meta property="og:image" content="https://pagewise.example/og/home-v2.png">
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  <meta property="og:image:alt" content="The Pagewise editor with a team note open">

  <meta name="twitter:card" content="summary_large_image">
</head>
TagWhat it doesNotes
og:titleThe bold headline on the cardRequired by the protocol. X truncates twitter:title at 70 characters, so keep the important words first.
og:descriptionOne or two lines under the titleThe protocol describes it as "a one to two sentence description." X caps twitter:description at 200 characters.
og:imageThe large preview imageRequired. Must be a full URL to a real image file. Sizes in the next section.
og:urlThe canonical address of the pageRequired. Meta asks for the undecorated URL, without session variables or tracking parameters.
og:typeWhat kind of object the page isRequired by the protocol; website for most pages, article for blog posts.
og:site_nameThe site's name, shown above or beside the title on some platformsRecommended. Google also reads it on your home page (see below).
og:image:width / og:image:heightThe image's pixel sizeLets Meta render the image on the very first share.
og:image:altA text description of the imageThe protocol says a page with an og:image "should specify og:image:alt."

Sources: ogp.me; Meta for Developers, Webmasters guide; X Developer Platform, Cards markup reference. Checked November 2026.

Note the attribute: Open Graph tags use property=, as in every example on ogp.me. Copy that form exactly rather than mixing styles, so a broken card never comes down to a typo in the attribute name.

What size should an og:image be?

Make it 1200 by 630 pixels, saved as PNG or JPG and well under 5 MB. That single file meets the current guidance from both Meta and X, so you do not need separate images per platform.

PlatformSize guidanceFile limits
Facebook and other Meta apps"At least 1200 x 630 pixels for the best display"; 600 x 315 as the floor for large cards; nothing smaller than 200 x 200; aspect ratio close to 1.91:1Up to 8 MB; og:image:type of image/jpeg, image/gif or image/png
XUses og:image as a fallback for twitter:imageUnder 5 MB; JPG, PNG, WEBP and GIF supported; SVG not supported

Sources: Meta for Developers, Images in link shares; X Developer Platform, Cards markup reference. Checked November 2026.

The tightest limit wins, so design for X's 5 MB ceiling and Meta's 1.91:1 shape. In practice a 1200 by 630 PNG with flat colors and large text lands far below 1 MB.

A few design rules that hold up across platforms. Keep text big and near the middle, because some apps crop the edges or show the card small on phones. Put the product name and one clear line of value on it, not a screenshot full of tiny UI. And never use an SVG for og:image: it looks fine in your browser and fails silently on X.

Do you need twitter: tags if you have Open Graph tags?

You need exactly one: <meta name="twitter:card" content="summary_large_image">. Everything else can come from Open Graph. X's cards markup reference spells out the fallbacks: twitter:title falls back to og:title, twitter:description to og:description, twitter:image to og:image, and twitter:image:alt to og:image:alt.

The catch is the card type. The same reference says that when og:type, og:title and og:description exist but twitter:card is missing, "a summary card may be rendered." A summary card is the small square thumbnail beside the text, not the wide image most people want. Adding the one twitter:card line is what gets you the large image.

The X reference also lists twitter:site, your product's @handle, and twitter:creator, the author's @handle. Add them if you have accounts you want credited. Its stated limits are worth knowing even when you rely on fallbacks: titles over 70 characters and descriptions over 200 get cut, and alt text maxes out at 420 characters.

How do you add and test Open Graph tags step by step?

  1. Make the image first. 1200 by 630, PNG or JPG, under 5 MB. Put it on your own domain at a path that includes a version, like /og/home-v2.png. The version matters for the caching problem below.
  2. Add the tags to the server-rendered head. On a static site, paste them into each page's head or your shared layout, with per-page values for title, description, URL and image. In a framework, use its head or metadata feature so the tags appear in the HTML the server sends.
  3. Use absolute URLs. Write https://yoursite.com/og/home-v2.png, not /og/home-v2.png. Every example on ogp.me uses a full URL, and a crawler reading your tags out of context has no reliable base to resolve a relative path against.
  4. View the page source, not the inspector. The tags must be in the raw HTML. Link preview crawlers are not browsers, and tags injected by client-side JavaScript are a gamble. We cover what different crawlers see in static HTML vs JavaScript badges.
  5. Run the page through Meta's Sharing Debugger. Meta's guide says it "will show which meta tags the crawler scrapes" and that it "also triggers a scrape of your page," which warms the cache before your first real share.
  6. Do a real test share. Paste the URL into a private message to yourself on the platforms your audience uses. That is the only check that shows exactly what readers will see.

If you host on Netlify, Vercel or Cloudflare Pages, nothing about the host changes these steps; the tags live in your HTML. Our free static hosting comparison covers the hosts themselves.

Almost always, caching. Platforms store what they scraped and keep showing it. Meta's image guidance says images are cached by URL, so if you replace the file but keep the address, you must "use a new URL for the new image or the image won't be updated." It also notes that updating an image does not change posts already shared; those need a refresh.

The fix, in order:

  1. Give the new image a new filename, for example home-v3.png, and update og:image.
  2. Deploy, then confirm in the page source that the new URL is live.
  3. Paste the page URL into Meta's Sharing Debugger to force a fresh scrape.
  4. Share again. Old posts may keep the old card; new shares get the new one.

There is also a first-share problem. Meta's crawler has to fetch and process an image before it can show it, so the very first share of a new page can appear with no image. Meta lists three ways around that: run the URL through the Sharing Debugger, force a scrape through its Graph API, or include og:image:width and og:image:height, which "specify the image dimensions to the crawler so that it can render the image immediately." The two size tags are the zero-effort option, which is why they are in the template above.

Do Open Graph tags help SEO?

Not as a ranking factor that Google has documented, but Google does read some of them. Its title link documentation lists "content in og:title meta tags" among the sources it uses to generate the clickable title in search results, alongside the <title> element, the main heading and anchor text. Its site name documentation says the site name system will "also consider content in og:site_name," though WebSite structured data is the most important signal if you want to state a preference.

So the practical rule: keep og:title consistent with your <title> and H1, because Google may pick any of them, and set og:site_name on your home page to the exact name you want shown. Google does not publish any ranking benefit from Open Graph tags, and we will not invent one.

The bigger payoff is indirect. A clean card earns more clicks when your link is shared on launch day, and those visits are the ones most likely to become links and mentions later. That matters most on the pages people share: your home page, your launch post, and, if you have one, the hub page that lists all your projects. If you link every project to a hub with a small credit badge, as BuiltByBadge sets up, give that hub its own card too. Our Product Hunt launch checklist and Show HN guide cover the moments these cards get the most views.

Common Open Graph mistakes on small sites

Sources

Frequently asked questions

What is the best og:image size in 2026?

Use 1200 by 630 pixels. Meta recommends at least 1200 x 630 for the best display and an aspect ratio close to 1.91:1, and X accepts JPG, PNG, WEBP and GIF under 5 MB. One PNG or JPG at that size and well under 5 MB works on both.

Why does my link preview show an old image?

Platforms cache what they scraped, and Meta caches images by URL. Upload the new image under a new filename, update og:image, deploy, then run the page through Meta's Sharing Debugger to force a fresh scrape. Posts shared before the change may keep the old card.

Do I need both Open Graph and Twitter card tags?

Mostly no. X falls back to og:title, og:description, og:image and og:image:alt. Add one line, twitter:card with the value summary_large_image, so X shows the large image instead of possibly rendering a small summary card.

Can I set Open Graph tags with JavaScript?

It is risky. Link preview crawlers fetch your page to read the tags, and not every crawler runs JavaScript. Put the tags in the HTML your server sends, then check the raw page source rather than the browser inspector to confirm they are there.

Do Open Graph tags affect Google rankings?

Google documents no ranking effect. It does list og:title as one source for the title link it shows in results, and it considers og:site_name on your home page when choosing a site name, so keep both consistent with your title and brand.

Built by @gloverbuilds