seolivly
Open Graph guide

How to Set Open Graph Tags

When someone shares your link, a few meta tags decide whether it shows a sharp card or a blank grey box. Here is how to set them.

What Open Graph tags are

Open Graph is a set of meta tags, originally created by Facebook, that describe a page for sharing. Social networks, messaging apps and collaboration tools read them to build link previews. Without them, each app guesses, often picking a logo, a random image or the cookie banner text.

The essential tags

<meta property="og:title" content="How to Set Open Graph Tags">
<meta property="og:description" content="Make shared links show the right title, text and image.">
<meta property="og:image" content="https://example.com/images/og-guide.jpg">
<meta property="og:url" content="https://example.com/guides/open-graph/">
<meta property="og:type" content="article">
<meta property="og:site_name" content="Example">
<meta name="twitter:card" content="summary_large_image">
  • og:title: can differ from your SEO title; write it for a social feed.
  • og:description: one or two sentences; some apps show it, some do not.
  • og:image: a full, public https URL.
  • og:url: the canonical URL, so shares of different versions count as one page.
  • og:type: website for most pages, article for posts.
  • twitter:card: X reads og: tags as a fallback, but this tag chooses the large or small card style.

All of these go inside the page's <head>.

Getting the image right

  • Size: 1200 x 630 px (about 1.91:1) works well for large cards on most platforms.
  • Safe area: keep text and faces away from the edges, since some apps crop to a square or a different ratio.
  • Text: keep any words on the image short and large; cards are often seen small on phones.
  • File: JPG or PNG, reasonably compressed. Our image resizer can produce an exact 1200 px wide version.

Setting tags in WordPress and other platforms

In WordPress, SEO plugins such as Yoast and Rank Math include social fields for each post, where you set the title, description and image; they output the tags for you. Shopify, Squarespace, Wix and similar platforms have a social sharing image setting at site and page level. On a hand-built site, paste the tags from the Open Graph generator into each page's head.

Testing and refreshing previews

  1. Check the tags in the generator's previews first.
  2. Publish, then view the page source to confirm the tags are really in the head, not added later by JavaScript, which some crawlers do not run.
  3. Share the link in a private message to yourself to see the real card.
  4. If an old preview sticks, use the platform's developer tool to re-fetch the page. Facebook's Sharing Debugger and LinkedIn's Post Inspector both do this.

Open Graph and SEO

Open Graph tags do not change search rankings directly. They affect how many people click your link when it is shared, which brings visits, and sometimes links. Treat them like the meta description: a small, durable piece of copy worth writing on purpose. Our guide on meta description length covers the search version.

Frequently asked questions

What are the most important Open Graph tags?

og:title, og:description, og:image and og:url, plus twitter:card for X.

What size should my Open Graph image be?

1200 x 630 px suits most large link cards. Keep important content away from the edges.

Why is my link preview showing the wrong image?

The tags may be missing or wrong, or the platform cached an old version. Fix the tags, then re-fetch with the platform's debugging tool.

Do I need separate Twitter tags?

X falls back to Open Graph tags, but twitter:card sets the card style. Adding it is quick.

Can I set Open Graph tags without code?

Yes. SEO plugins in WordPress and settings in most site builders let you fill them in through forms.

Keep going