Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put Open Graph metadata in your page’s <head> so link-sharing systems can identify the title, type, image, canonical URL and description you want displayed. The four core properties are og:title, og:type, og:image and og:url. Add the optional fields that describe your page, then validate the deployed HTML with the debugger or preview workflow of the platform where the link will be shared.

Copy-paste Open Graph tags example

Use this as a starting point and replace every sample value with information about the actual page. The protocol’s canonical syntax uses the property and content attributes.

<!doctype html>
<html prefix='og: https://ogp.me/ns#'>
<head>
  <meta charset='utf-8'>
  <title>Example page</title>

  <meta property='og:title' content='Example page'>
  <meta property='og:type' content='website'>
  <meta property='og:url' content='https://example.com/page/'>
  <meta property='og:image' content='https://example.com/images/share-card.jpg'>
  <meta property='og:description' content='A concise description of this page.'>
  <meta property='og:site_name' content='Example site'>
</head>
<body>
  ...
</body>
</html>

The prefix declaration identifies the Open Graph vocabulary. A normal HTML document can still be parsed without it by many consumers, but retaining the protocol’s example makes the namespace explicit.

The four required Open Graph properties

Property What it represents Implementation guidance
og:title The title shown for the object. Use the page’s specific headline, not a generic site slogan.
og:type The kind of object being described. website is a sensible value for an ordinary site page. Specialized types can require additional properties.
og:image The image URL representing the object. Use an absolute, publicly reachable URL that returns the intended image.
og:url The object’s permanent graph identity. Set it to the canonical page URL, not a tracking, campaign or session URL.

These elements belong in the document head. They describe the URL being shared; they do not replace the visible title, heading or body content that a visitor sees.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Optional tags that improve a preview

Description and site identity

og:description supplies an optional one- or two-sentence summary. Write a useful explanation of this page rather than repeating a boilerplate site description. og:site_name identifies the larger site when the page belongs to one.

Locale declarations

Use og:locale for the page’s locale and og:locale:alternate for other available locales. The protocol presents language-territory values such as en_US. Declare only locales for which you actually provide content.

Audio and video

og:audio and og:video are optional media URLs that complement the object. Add them when the shared page has a representative audio or video resource and the receiving consumer supports those properties.

Multiple images and structured image properties

You may repeat an Open Graph property when an object has multiple values. For images, the first og:image from top to bottom is preferred when values conflict. Put structured properties immediately after the root image they describe; a later root declaration starts a new image entry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<meta property='og:image' content='https://example.com/card-one.jpg'>
<meta property='og:image:width' content='1200'>
<meta property='og:image:height' content='630'>

<meta property='og:image' content='https://example.com/card-two.jpg'>

The dimensions in this example illustrate the markup grouping. They are not a universal requirement established by the protocol. If you provide alternatives, put the image you prefer first and keep each image’s width, height or MIME declaration next to its corresponding root tag.

Choose an accurate type and canonical URL

Selecting og:type

Use website for a typical landing page, article index or marketing page when no more precise object type applies. A specialized type is useful only when it truthfully describes the object and you supply any additional properties that type requires. Do not select a type merely because a platform’s preview happens to look different.

Setting og:url

Make the value identical to the URL you consider canonical, including the intended trailing-slash convention. Exclude analytics parameters, temporary redirects, login tokens and other incidental variants. Because the protocol treats this value as the permanent graph ID, two URLs that show the same page should normally converge on one canonical value.

Implement tags safely in a real site

  1. Choose page-level values. Generate the title, description, type, image and canonical URL from the page being rendered. Do not copy the sample text into production.
  2. Emit tags in the head. Server-rendered HTML is the most dependable starting point. If a framework inserts metadata client-side, confirm that the deployed response contains the tags when fetched without an interactive browser.
  3. Use absolute URLs. The image and URL values should include the scheme and host, so a crawler does not have to resolve a relative path.
  4. Keep one preferred value first. If you repeat a property, order the values deliberately because the first value wins when a consumer sees conflicting entries.
  5. Deploy before validating. Inspect the actual public URL, not a local template or an unreleased staging route.

Framework and template checks

  • Confirm that HTML escaping preserves ampersands and quotation marks inside content values.
  • Ensure every route has a distinct canonical URL when pages are distinct objects.
  • Prevent duplicate layout and page-level tags from producing two competing og:title or og:url values.
  • Check that authentication, robots rules or a firewall do not block the image URL or the page from the intended crawler.

Validate the deployed result

The official Open Graph Protocol site lists Facebook Object Debugger as a parser and debugger. Use the target platform’s current own debugger or link-preview workflow after deployment, especially if a preview is stale or a crawler does not appear to read the expected metadata. Protocol-level correctness does not guarantee that every social network will render an identical card; each service can fetch, cache and interpret metadata differently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical validation checklist

  • View the page source or the fetched response and verify that the tags are inside <head>.
  • Open each og:image URL directly in an unauthenticated session and confirm it returns the intended asset.
  • Compare og:url with the canonical URL exposed by your site and with the URL you plan to share.
  • Run the URL through the destination platform’s current preview tool, then re-check after changing metadata because crawlers may cache an earlier response.

Troubleshooting common Open Graph problems

The preview uses the wrong title or image

Inspect the deployed source for duplicate properties. Remove stale layout tags, put the preferred value first and request a fresh scrape in the destination platform’s debugger or preview flow. Also verify that the image URL does not redirect to an access-controlled resource.

The preview is blank or has no image

Check that og:image is an absolute HTTPS URL, returns an image for an unauthenticated request and is not blocked by a firewall or session requirement. A page-relative path, a broken redirect or a crawler being denied can all prevent retrieval.

A shared URL resolves to the wrong object

Compare the shared URL, redirects and og:url. Replace tracking or campaign values in og:url with the intended canonical URL, and make sure different pages are not all emitting the same site-wide canonical value.

Changes are not visible immediately

The receiving service may be showing a cached fetch. Use its current debugger or re-scrape control, then test the public URL again. Do not assume that changing HTML guarantees an immediate update on every network.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Localized pages show the wrong language

Set og:locale to the page’s actual language-territory value and add og:locale:alternate only for real alternate versions. Keep each locale’s canonical URL and page content aligned.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Capture a rendered preview when debugging

Metadata inspection tells you what the HTML declares; a screenshot can show what a crawler-facing page actually looks like after redirects, consent dialogs and client-side rendering. For a do-it-yourself check, open the public URL in a clean browser profile, wait for the page to finish loading, dismiss any consent dialog, and capture the viewport or full page. Repeat after publishing a metadata change so you can compare the rendered result with the values in source.

Or skip the browser setup

ScreenshotNeo provides a GET-based website screenshot API and an MCP server for developers and AI agents. The API can accept a page URL and return PNG, JPEG, WebP or PDF; it can also wait for a selector, delay or network idle, load lazy images in full-page captures, select an element by CSS selector and apply custom headers, cookies, user agents, JavaScript or CSS. Cookie and consent banners, newsletter popups and chat widgets are removed before capture; bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/page/ -o shot.webp

See the ScreenshotNeo documentation for all request options and response details. The same request in Python is:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com/page/"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/page/' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo includes an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots, and every feature is available on every plan. Sign up free for ScreenshotNeo.

Open Graph tags checklist

  • og:title, og:type, og:image and og:url are present in the page head.
  • og:url is the canonical, non-tracking URL for that page.
  • og:type accurately describes the object and any specialized requirements are met.
  • Images are absolute, publicly retrievable URLs; the preferred image appears first.
  • Optional description, site name and locale values match the page.
  • The deployed URL has been checked with the destination platform’s current debugger or preview workflow.

Frequently Asked Questions

Do Open Graph tags replace a page title or meta description?

No. They are separate metadata for link previews; keep a normal HTML title, visible heading and search-oriented metadata as appropriate for your page.

Can I use a relative path in og:image?

An absolute URL is the safer implementation because crawlers fetch the image independently of the page’s base URL.

Should every page use og:type=’website’?

Only when that value accurately describes the object. Use a more specific type when appropriate and provide properties that type requires.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why can two platforms show different cards from the same HTML?

Each platform controls its own crawler, cache and interpretation. Validate on the service where the link will actually be shared.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.