Generate Open Graph metadata when a public page is likely to be shared as a link and its preview needs controlled, accurate values.
Open Graph gives sharing services a protocol-level description of a page rather than leaving each service to infer a representation from visible HTML. The Open Graph Protocol defines four basic properties—og:title, og:type, og:image and og:url—while optional properties can add context. The practical test is distribution and readiness: generate tags for pages that are sent outside your site and whose content is ready for an intentional preview, then keep every value aligned with what visitors actually see.
Open Graph metadata is not a universal publishing requirement. Its role is the shared link preview, so a page with no meaningful public image or stable permanent URL is not ready for a complete block. Prioritize pages according to real sharing use cases instead of applying a blanket rule that every URL needs tags.

When Open Graph metadata is worth generating
Start with distribution. Articles, landing pages, product pages, documentation and campaign pages often travel through messaging, email, communities or support conversations where a link may be previewed. These pages are strong candidates because they normally have a clear subject, a representative image and an identity that should remain stable.
- The page is public and intended to be opened from a shared link.
- The preview can communicate the page’s subject or brand more clearly than a raw URL.
- You can supply a permanent page URL and a publicly reachable image.
- The metadata can accurately describe the same content visitors see on the page.
Use a page-level need-or-wait checklist
Use the page’s actual distribution and readiness rather than its template type to make the decision.
| Page situation | Practical decision | Reason |
|---|---|---|
| A public article is likely to be shared | Generate now if all required values are ready | A controlled title, type, image and permanent URL can describe the article consistently. |
| A landing, product or documentation page is shared regularly | Generate and maintain the metadata | These pages are likely to appear in conversations where a useful preview improves recognition and context. |
| A public page has a temporary URL or no representative image | Wait until the page is ready | The required object URL or image would be incomplete, unstable or misleading. |
| A login, admin, error or private page is the target | Usually defer | A sharing crawler may not be able to access the page, so a preview would offer little practical value. |
| The object is a video, music item or profile | Use a specialized implementation | Those types need additional structured properties that the focused generator does not support. |
| The page is rarely shared and its preview would add no useful context | Make it a lower-priority review | Open Graph remains possible, but other page-level work may provide more value. |
Separate two questions: Is this URL likely to be distributed, and are all required values truthful and ready? A yes to both means generate it. A yes to distribution and no to readiness means fix the missing URL, image or content first. A low distribution score does not prohibit tags, but it does affect their priority.
Match the page to the supported object type
The four required properties answer four different preview questions. og:title names the shared object, og:type classifies it, og:image supplies a representative visual, and og:url identifies the permanent object. A page can share a topic while still needing a different title or image for its preview, so these values should be edited for the destination rather than copied blindly.
The supported object types are website and article. Use website for a general site, destination or landing page, and article for editorial content. The wider protocol ecosystem includes music, video, profile and other structured types with their own required or optional fields, so use a specialized implementation for those objects. Optional properties can include og:description, og:site_name and og:locale. The focused locale validator accepts one conservative language_TERRITORY value such as en_US; alternate locales and script subtags require additional protocol properties and editorial decisions outside this form.
Generate and publish a complete metadata block
- Choose website or article, then enter an accurate title for the object. The title should identify the page without making a claim that the visible content does not support.
- Provide the permanent page URL and representative image URL. Both must be absolute HTTP or HTTPS addresses without embedded credentials or fragments. Accepted URLs are normalized by the browser URL parser, and the image should point to a publicly reachable file.
- Add optional context when it improves the preview. Use og:description to summarize the object, og:site_name to identify the larger site and og:locale for the primary language and territory. Text is trimmed and length-bounded, control characters are rejected, and attribute values are escaped.
- In the Open Graph Generator, generate the metadata. Missing any required value prevents output. The tool emits property-based meta elements in stable, required-first order, performs the work in the browser and does not fetch either URL.
- Copy the protocol-only block into the HTML head of the canonical page. Do not display it as visible text, encode the entire block again or publish it through both a framework and a plugin.
- Inspect the delivered source after deployment. Build tools can reorder, overwrite or add conflicting properties, so confirm that the intended values appear in the final page rather than trusting the generator output alone.
- Use each target platform’s current preview debugger or share inspector to check crawler access, image handling and cache refresh behavior.
The HTML meta element specification places metadata elements in the document head. Treat the Open Graph block as markup in that location, and give the deployment one clear source of truth so the same properties are not duplicated through multiple paths.
Separate generator validation from live checks
The generator validates the metadata block, while a successful preview depends on the page, image response and sharing service. Keep those layers separate during review.
| Layer | What the generator checks | What you must check separately |
|---|---|---|
| Required properties | All four required values are present, the object type is accepted and the output uses stable property syntax | The delivered source contains the intended values exactly once and no build step has replaced them. |
| Page and image addresses | Absolute HTTP or HTTPS URLs, no embedded credentials or fragments, and browser normalization | Public reachability, redirects, crawler access and authentication requirements. |
| Text values | Trimming, length bounds, control-character rejection and exact HTML attribute escaping | Editorial accuracy, consistency with visible content and suitability for the destination. |
| Locale | A conservative two-letter language and two-letter territory shape | Whether it matches the content and whether alternate versions need separate properties. |
| Image | URL shape only | HTTP status, MIME type, dimensions, byte size, aspect ratio, redirects, robots controls and authentication. |
| Platform presentation | Protocol property order and escaping | Image handling, cropping, truncation, ignored fields, caching and account-level policies. |
The tool cannot verify those live conditions because it does not fetch either URL. A syntactically valid address can still fail to return a crawlable image, and a valid metadata block can still be overwritten or ignored after it reaches a sharing service.
Confirm what each sharing service renders
After publishing, compare the raw HTML source, the fetched image response and the live platform preview. The source confirms the exact properties in the delivered document. The image response shows whether the expected file can be retrieved. The platform debugger reveals what that service currently renders. Use each service’s current tool because image handling, field support, cropping, text truncation and policy decisions vary.
A metadata update may not appear immediately because a sharing service can continue serving an older cached preview. Allow for the service’s current cache-refresh behavior and then retest. The public page must remain accessible to its crawler, and its metadata must continue to match the visible content. If the page moves or changes identity, update the Open Graph URL, image and other page representations together so old and new versions do not conflict.
The generator does not create Twitter Card metadata. Some services can consume Open Graph properties as fallbacks, but Twitter and other service-specific tags and validation rules remain separate concerns. A valid Open Graph block therefore cannot promise identical cards, images or crops on every platform.
The practical decision rule is simple: generate metadata when a public page has a real sharing use case and all four required values are ready; defer until its title, URL and image are stable; and use a richer implementation when the object needs more than website or article.
For a deeper look, see How to Decide If You Need to Generate ads.txt.
For a deeper look, see How Do I Document the Steps I Use to Generate Open Graph.