What Is Open Graph? β Definition and How It Works
Learn what Open Graph tags are, which properties matter, and why they are a reliable fallback for page-level extraction.
Open Graph is a set of <meta> tags that tell other platforms how to represent a page: its title, description, image, type, and canonical URL. It exists so a shared link renders as a card rather than a bare URL.
1. The Core Properties
<meta property="og:title" content="Wireless Keyboard Review">
<meta property="og:description" content="A compact mechanical keyboard tested over three months.">
<meta property="og:image" content="https://example.com/kb-card.jpg">
<meta property="og:url" content="https://example.com/reviews/wireless-keyboard">
<meta property="og:type" content="article">
<meta property="og:site_name" content="Example Reviews">
Note property, not name β Open Graph uses the RDFa attribute, and an extractor that only reads name finds nothing.
2. Type-Specific Extensions
og:type selects a further set of properties:
| Type | Additional properties |
|---|---|
article |
article:published_time, article:author, article:section, article:tag |
product |
product:price:amount, product:price:currency, product:availability |
video.* |
video:duration, video:release_date |
book |
book:author, book:isbn, book:release_date |
article:published_time is often the most reliable publication date on a page, since it is an ISO timestamp rather than a display-formatted string.
3. Why It Is Useful for Extraction
Open Graph is deliberately maintained. Sites care how their links look when shared, so these tags tend to be present, accurate, and updated even where other structured data has gone stale.
That gives it three practical properties:
- Near-universal presence on content pages.
- A single, consistent shape across every site, unlike per-site selectors.
- Human-curated values β the title and description are what the publisher wants shown.
4. Where It Fits in an Extraction Cascade
Open Graph is the second rung, not the first:
- JSON-LD β richest, most fields.
- Open Graph β reliable title, description, image, canonical URL, date.
- Microdata or RDFa β where present.
- Standard meta and
<title>β a final fallback. - Content extraction β the article body, which Open Graph never carries.
The cascade matters because each rung fails independently. A site that drops JSON-LD in a redesign usually keeps its share cards working.
5. Extracting It
from bs4 import BeautifulSoup
def open_graph(html):
soup = BeautifulSoup(html, "html.parser")
og = {}
for tag in soup.find_all("meta"):
prop = tag.get("property", "")
if prop.startswith(("og:", "article:", "product:")):
content = tag.get("content")
if content:
og.setdefault(prop, content)
return og
setdefault rather than assignment is deliberate: a property may legitimately appear more than once β og:image in particular β and the first is conventionally the primary one.
6. Known Limitations
- No body content. Open Graph describes a page; it never contains the article.
- Description is marketing copy, often truncated to fit a card, not a summary of the content.
og:urlmay be a canonical that differs from the fetched URL β useful for deduplication, and a trap if you assume they match.- Images are card-optimised crops, not the page's main image.
- Values can lie. They are publisher-controlled text, which is a reason to treat them as claims rather than facts when the page is untrusted.
7. Twitter Cards Overlap
twitter: tags cover similar ground, and platforms fall back to Open Graph when they are absent. When both exist and disagree, they are worth capturing separately rather than merging, because the difference is occasionally the interesting signal.
8. Summary
Open Graph is a set of property-attributed meta tags describing a page's title, description, image, canonical URL, and type, with type-specific extensions for articles, products, and media.
Because sites actively maintain their share cards, it is the most dependable rung below JSON-LD in an extraction cascade β as long as you remember it describes the page rather than containing it, and that every value is publisher-controlled.