# Configure Open Graph and X Cards

- Check 10.21 · On-page SEO and metadata · Important
- Source: https://checklist-seo-geo.com/en/page-seo-metadata/configure-open-graph-x-cards
- Add Open Graph and X Cards tags to every template, with a 1200 × 630 image, on WordPress, Shopify, Drupal, Laravel, Next.js, Nuxt or in plain HTML.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/page-seo-metadata/configure-open-graph-x-cards.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

Open Graph is a set of `<meta property="og:…">` tags that describe a page for the preview shown when its link is shared: title, description, image, URL. Facebook, LinkedIn, WhatsApp, Slack, Discord, Teams, iMessage and most messaging apps read it. X (formerly Twitter) uses its own `twitter:…` tags, of which only one is really needed on top of Open Graph. The check consists of generating these tags on every template, with values specific to each page and a sharing image in the right format.

## Why it matters

**Without tags, every platform guesses.** It takes the `<title>`, whatever paragraph comes first and any image on the page: a tiny logo, a cookie banner, or nothing at all. A link with no image draws less attention in a news feed or a conversation.

**The protocol is simple.** The Open Graph specification defines four required properties: `og:title`, `og:type`, `og:image` and `og:url`. The `og:description`, `og:site_name` and `og:locale` properties are optional but useful. The image accepts structured properties: `og:image:width`, `og:image:height`, `og:image:type` and `og:image:alt`. Meta recommends specifying width and height so that the image shows from the very first share.

**Google reads `og:title` too.** Among the sources Google lists for generating a result’s title link is the content of `og:title` tags, alongside the `<title>`, the H1 and other text on the page. An `og:title` consistent with the title avoids sending conflicting signals.

**AI assistants share links.** When a user copies into a messaging app a link found in ChatGPT, Perplexity or Copilot, it is the Open Graph preview that appears. Whether generative engines themselves use Open Graph tags is not documented.

## What it improves

- **Click-through rate on shares**: a preview with a clear image, title and description attracts more clicks than a bare link. The effect is not quantified by the platforms.
- **Brand image**: control over the image and text shown on each network and messaging app.
- **Title consistency**: `og:title` is one of Google’s sources for the title link.
- **Social and referral traffic**: indirect, through the quality of the previews.
- **Rankings**: no direct effect.

## How to check

List a page’s tags:

```bash
curl -s https://example.com/guides/infusion-the-vert/ | grep -o -i -E '<meta[^>]+(property|name)="(og|twitter):[^"]+"[^>]*>'
```

Expected result: `og:title`, `og:type`, `og:url`, `og:image` (absolute HTTPS URL), `og:image:width`, `og:image:height`, `og:image:alt`, `og:description`, `og:site_name`, `og:locale`, and `twitter:card`. Each tag is present only once, unless several images are intentional.

Then check that the image responds 200 with an image type:

```bash
curl -s -o /dev/null -w "%{http_code} %{content_type} %{size_download}\n" https://example.com/og/infusion-the-vert.jpg
```

Testing the actual rendering on each platform is the subject of the check [test social sharing](https://checklist-seo-geo.com/en/page-seo-metadata/test-social-sharing).

## How to implement

### Before you start

**Values per tag**:

| Tag | Value | Note |
|---|---|---|
| `og:title` | Page title, without the site name | Meta recommends not repeating the brand in it |
| `og:description` | One or two sentences | Can reuse the meta description |
| `og:url` | Absolute canonical URL | Identical to the canonical tag |
| `og:type` | `website` (home, pages), `article` (articles), `product` depending on the platform | |
| `og:image` | Absolute HTTPS URL of an image specific to the page | Fallback: generic brand image |
| `og:image:width` / `height` | Actual dimensions in pixels | `1200` and `630` |
| `og:image:alt` | Description of the image | |
| `og:site_name` | Brand name | |
| `og:locale` | `fr_FR` | Underscore, unlike `lang`. See [translate Open Graph and set og:locale](https://checklist-seo-geo.com/en/translating-seo-elements/translate-open-graph-set-oglocale) |
| `twitter:card` | `summary_large_image` | Large image in X |

**The sharing image.** The 1200 × 630 pixel format (1.91:1 ratio) is the de facto standard. LinkedIn specifies a minimum of 1200 × 627 pixels, a 1.91:1 ratio and a maximum file size of 5 MB; Meta recommends at least 1080 pixels wide. Aim for a JPEG or PNG under 1 MB, with the subject centered and any text kept away from the edges, because some messaging apps crop to a square. Next.js rejects at build time an Open Graph image over 8 MB and an X image over 5 MB: these are ceilings, not targets.

**X tags.** X reads the equivalent Open Graph tags when its own tags are missing: in practice, `twitter:card` is enough, with `twitter:site` (the brand’s account) if you have one. Only add `twitter:title` or `twitter:image` to show different content on X.

**Reference HTML template**:

```html
<meta property="og:type" content="article">
<meta property="og:site_name" content="Thé des Lisières">
<meta property="og:locale" content="fr_FR">
<meta property="og:url" content="https://example.com/guides/infusion-the-vert/">
<meta property="og:title" content="Brewing green tea: temperature, time and dosage">
<meta property="og:description" content="The right settings for green tea without bitterness: water at 70-80 °C, 2 to 3 minutes, 2 g per 20 cl.">
<meta property="og:image" content="https://example.com/og/infusion-the-vert.jpg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="Cast-iron teapot and a steaming cup of sencha on a wooden table">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@thedeslisieres">
```

Open Graph tags use the `property` attribute, X tags the `name` attribute. Put them in the `<head>`, before any heavy script: Meta’s crawler only reads the first megabyte of the page.

### WordPress

Versions: WordPress 6.4 and later, Yoast SEO 20 and later, Rank Math 1.0.

Do not combine two sources of tags: the theme, Jetpack and an SEO plugin can each produce them.

**Yoast SEO**: `Yoast SEO > Settings > Site features`, social sharing section, “Open Graph data” toggle (on by default) and the X card data toggle. Set the site’s fallback image in the site representation settings (`Settings > General > Site basics`, Site image). For each post, the Social tab of the Yoast box lets you choose an image and a title specific to sharing.

**Rank Math**: Open Graph and X tags are generated by default. Fallback image: `Rank Math SEO > Titles & Meta > Global Meta`, default OpenGraph image. For each post: the Edit Snippet button, Social tab.

Without a plugin, add the tags in the child theme’s `header.php` or through the `wp_head` hook, using `get_the_title()`, `wp_get_canonical_url()` and `get_the_post_thumbnail_url( null, 'full' )`.

### Shopify

Versions: Online Store 2.0 themes (Horizon, Dawn), all Shopify plans, November 2026.

Recent themes generate the tags. Horizon and Dawn produce them in `snippets/meta-tags.liquid`, called from `layout/theme.liquid`: `og:site_name`, `og:url` (canonical URL), `og:title`, `og:type` (`product` or `article` depending on the page), `og:description`, the page image with its dimensions, the price on product pages, and `twitter:card` set to `summary_large_image`.

- **Fallback image**: `Online Store > Preferences`, social sharing image and SEO section.
- **Product pages and blog posts**: the image used is the product’s main image or the post’s featured image. Choose it accordingly, or add a dedicated sharing image in a metafield and modify the snippet.
- **Title and description**: those of the “Search engine listing” section of each item.

If your theme has no equivalent snippet, copy the one from Horizon or Dawn into `snippets/` and call it in the `<head>` with `{% render 'meta-tags' %}`.

### PrestaShop

Versions: PrestaShop 8 and 9, Classic and Hummingbird themes.

The Classic and Hummingbird themes (the default theme since PrestaShop 9.1) add Open Graph tags on product pages (`templates/catalog/product.tpl`), not on every page. For categories, CMS pages and the home page, add them in the `head` block of the relevant templates in a child theme, or use an SEO module that handles them. Then check that there are not two competing `og:image` tags on product pages.

### Magento

Versions: Magento Open Source and Adobe Commerce 2.4.

Magento produces Open Graph tags on product pages (templates of the `Magento_Catalog` module). For categories and CMS pages, add a block in the `<head>` through a module or an SEO extension. The title and description values come from the Meta Title and Meta Description fields of each item.

### Drupal

Versions: Drupal 10 and 11, Metatag module 2.

Install the Metatag module and enable its Open Graph and Twitter Cards submodules. In `Configuration > Search and metadata > Metatag` (`/admin/config/search/metatag`), set the global defaults, then defaults per content type with tokens: `[node:title]`, `[node:summary]`, `[node:url]`, and for the image a token for the image field, with a 1200 × 630 image style.

### Wix, Squarespace and Webflow

All three platforms generate Open Graph tags. In the SEO settings or each page’s settings, a social sharing section lets you choose the image and edit the title and description. For Webflow blog posts and collection items, bind the Open Graph image to an image field of the collection. Check the result in the published source code.

### Laravel

Versions: Laravel 11 to 13.

In the main template, with variables that each view fills in:

```blade
{{-- resources/views/layouts/app.blade.php --}}
@php
    $ogImage = $ogImage ?? asset('images/og-default.jpg');
@endphp
<meta property="og:type" content="{{ $ogType ?? 'website' }}">
<meta property="og:site_name" content="{{ config('app.name') }}">
<meta property="og:locale" content="{{ str_replace('-', '_', app()->getLocale()) }}">
<meta property="og:url" content="{{ $canonical ?? url()->current() }}">
<meta property="og:title" content="{{ $ogTitle ?? $title }}">
<meta property="og:description" content="{{ $description }}">
<meta property="og:image" content="{{ $ogImage }}">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:alt" content="{{ $ogImageAlt ?? $title }}">
<meta name="twitter:card" content="summary_large_image">
```

Pass `$title`, `$description`, `$canonical` and `$ogImage` from the controller or the view. Blade escapes values with `{{ }}`. If the locale is `fr`, `og:locale` will be `fr`: specify `fr_FR` if you want the full form. Do not hard-code `width` and `height` if not all images are 1200 × 630.

### Next.js

Versions: Next.js 15 and 16 (App Router).

With the App Router, declare the values in the `metadata` object or `generateMetadata`:

```tsx
// app/guides/[slug]/page.tsx
import type { Metadata } from 'next'
import { findGuideBySlug } from '@/lib/guides'

export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
  const { slug } = await params
  const guide = await findGuideBySlug(slug)

  return {
    title: guide.title,
    description: guide.description,
    alternates: { canonical: `/guides/${slug}` },
    openGraph: {
      type: 'article',
      siteName: 'Thé des Lisières',
      locale: 'fr_FR',
      url: `/guides/${slug}`,
      title: guide.title,
      description: guide.description,
      images: [{ url: guide.ogImage, width: 1200, height: 630, alt: guide.ogImageAlt }],
    },
    twitter: { card: 'summary_large_image' },
  }
}
```

Set `metadataBase: new URL('https://example.com')` in `app/layout.tsx` so that relative URLs become absolute. Alternatively, place an `opengraph-image.jpg` file (with `opengraph-image.alt.txt`) in the route folder, or generate the image with an `opengraph-image.tsx` file and `ImageResponse`. An image declared in the page’s `metadata` takes precedence over the file.

### Nuxt

Versions: Nuxt 3 and 4.

In the page, with `useSeoMeta`:

```ts
useSeoMeta({
  title: guide.value.title,
  description: guide.value.description,
  ogType: 'article',
  ogSiteName: 'Thé des Lisières',
  ogLocale: 'fr_FR',
  ogUrl: `https://example.com/guides/${guide.value.slug}`,
  ogTitle: guide.value.title,
  ogDescription: guide.value.description,
  ogImage: guide.value.ogImage,
  ogImageWidth: 1200,
  ogImageHeight: 630,
  ogImageAlt: guide.value.ogImageAlt,
  twitterCard: 'summary_large_image',
})
```

The tags are rendered server-side in SSR mode or generated at build time in static mode.

### Astro

Versions: Astro 5 to 7.

In the layout, receive the values as props and write the tags from the reference template. Build absolute URLs with `new URL(chemin, Astro.site)`, after setting `site: 'https://example.com'` in `astro.config.mjs`.

## Common mistakes

- **`og:image` as a relative URL** (`/og/image.jpg`): most platforms ignore it. Always use an absolute HTTPS URL.
- **The same image and title across the whole site**: every share looks like the previous one.
- **Duplicate tags**: theme plus plugin, with two different `og:image` tags. The platform chooses, often the wrong one.
- **`og:url` different from the canonical**: a URL with tracking parameters, the HTTP version or without the trailing slash.
- **Image too small**: LinkedIn, for example, shows images less than 401 pixels wide as a simple thumbnail.
- **Image blocked** by robots.txt, a firewall or directory protection: the preview stays without an image.
- **Tags injected with client-side JavaScript**: sharing crawlers generally do not run JavaScript. The tags must be in the HTML served.
- **Image replaced at the same URL**: Meta caches images by URL. To change the image, change its address.

## Frequently asked questions

### Do I still need twitter: tags if I have Open Graph?

Only one is really useful: twitter:card, which chooses the preview format, for example summary_large_image for a large image. For the title, description and image, X reads the equivalent Open Graph tags when its own tags are missing. Only add twitter:title, twitter:description or twitter:image if you want to show different content on X than on other platforms.

### What size should the Open Graph image be?

The safest format is 1200 × 630 pixels, at a 1.91:1 ratio. LinkedIn requires at least 1200 × 627 pixels and 5 MB at most, and Meta recommends at least 1080 pixels wide. Use a lightweight JPEG or PNG, keep the subject and any text in the center, because some messaging apps crop to a square, and declare the dimensions with og:image:width and og:image:height.

### Do Open Graph tags improve SEO?

Not directly: they are not a ranking factor. They improve the preview of your links shared on social networks and in messaging apps, and therefore clicks on those shares. Google does, however, list og:title among the sources it may use to generate a result’s title link: keep it consistent with your title tag to avoid an unexpected title in search.

### Should og:title be identical to the title tag?

Not necessarily. The title tag often contains the site name and targets search, whereas og:title can be shorter and catchier for a news feed. Meta recommends not repeating the brand in it, since og:site_name already gives it. Keep the same topic in both: Google may use og:title to generate the title link, and a difference in meaning would produce an inconsistent result.

## Resources

- [The Open Graph protocol](https://ogp.me/)
- [Meta for Developers: Sharing for Webmasters](https://developers.facebook.com/docs/sharing/webmasters/)
- [Meta for Developers: Sharing best practices](https://developers.facebook.com/docs/sharing/best-practices/)
- [LinkedIn: Make your website shareable on LinkedIn](https://www.linkedin.com/help/linkedin/answer/a521928)
- [Google Search Central: Influencing your title links](https://developers.google.com/search/docs/appearance/title-link?hl=en)
- [Next.js: opengraph-image and twitter-image](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image)
- [Nuxt: useSeoMeta](https://nuxt.com/docs/api/composables/use-seo-meta)
- [Drupal: Metatag module](https://www.drupal.org/project/metatag)

Next steps: [test social sharing](https://checklist-seo-geo.com/en/page-seo-metadata/test-social-sharing) and [translate Open Graph and set og:locale](https://checklist-seo-geo.com/en/translating-seo-elements/translate-open-graph-set-oglocale).
