Back to the blog
Best Practices

How to Fix Magento Social Media Previews with Open Graph Images

Learn how to use the Mosaicora Open Graph module to publish reliable Magento metadata, optional generated social images, and local-image fallbacks across product, category, CMS, and home pages.

12 min readUpdated July 29, 2026

You will learn

  • Configure a store-view-safe metadata baseline without editing storefront templates
  • Choose between Mosaicora-generated previews and the standalone local-image fallback
  • Map page context, verify output, and manage duplicate social tags safely
Magento product page metadata flowing through Mosaicora image generation into a share preview card

The direct answer

The Mosaicora Open Graph module gives Magento, Mage-OS, and Adobe Commerce storefronts one store-scoped source for product, category, CMS, and home-page social metadata. It can optionally replace local social images with Mosaicora CDN previews generated from page context and JSON-LD hints, while preserving a configurable local-media fallback with cached 1200 by 630 images when Mosaicora is not enabled.

What the module covers on a Magento storefront

A share preview should describe the page a shopper will reach, not a generic storefront. The module adds Open Graph metadata during layout generation for product pages, category pages, CMS pages, and the home page. That gives marketing and development teams one place to control the social contract across the page types that customers most often share.

  • Product pages resolve metadata from the active product.
  • Category pages resolve metadata from the active category.
  • CMS pages resolve metadata from the page rendered by Magento.
  • The home page uses the active CMS home page when one exists, then falls back to the configured site name and default image.

Open source and available on GitHub

The module is open source under the GPL-3.0-or-later license. Review the source, release notes, and contribution guidance in its public repository.

Install and enable it in the normal Magento workflow

The package supports Magento 2, Mage-OS, and Adobe Commerce storefronts running PHP 8.1 through 8.5. Install it from the Magento project root, then run your usual upgrade and cache process. Keep Composer dependencies at the project level rather than creating a nested vendor directory inside a mounted module.

Install the Open Graph module
composer require mosaicora/module-opengraph

bin/magento module:enable Mosaicora_OpenGraph
bin/magento setup:upgrade
bin/magento cache:flush config layout block_html eav full_page config_webservice

Set the store-view metadata baseline and content sources

Configuration lives under Stores, Configuration, Mosaicora, Open Graph. Where Magento allows it, settings are store-scoped, so each store view can select its own site name, social-card behavior, and content fields. Set the Open Graph basics first, then choose the product, category, and CMS title and description sources that match the attributes your team maintains.

Baseline settings to decide with marketing and development

  • Enable Open Graph tags and set the social site name for each store view.
  • Enable Twitter Card tags when the storefront should emit the equivalent twitter-prefixed fields.
  • Choose a Twitter Card type that matches the intended image treatment.
  • Select content-source fields with dependable values before relying on generated or fallback images.
  • Leave competing-tag removal off until you have identified every theme or extension that also publishes social metadata.
Configure the module per store view, including social metadata, content sources, optional Mosaicora image generation and hint mappings, the local-image fallback, and duplicate-tag handling.

Choose Mosaicora previews or a local image fallback

Mosaicora image generation is optional. When it is enabled for a store view, the module replaces og:image and twitter:image with a Mosaicora CDN preview generated from page context. Add the public Site ID for the matching Mosaicora site, then use the advanced mappings to pass the product, category, and CMS values that should inform the generated image. When it is disabled, the module keeps the local Magento image workflow.

Enable Open Graph Image for the upload that should represent this product when its page is shared. It is a separate role from the storefront image roles.

Mosaicora enabled

Generated previews from page context

Use a public Site ID and semantic mappings to replace the social image with a CDN preview tailored to the resolved page metadata.

Mosaicora disabled

A local Magento image fallback

Use the configured product image source, a default image, and local image optimization without connecting a Mosaicora account.

Keep the standalone local-image path dependable

When Mosaicora image generation is off, the module resolves the configured product image source and then follows its normal fallback list. The Open Graph Image product-media role remains a share-only option for local workflows. Local Magento media can be transformed into cached 1200 by 630 share images, while external image URLs are intentionally emitted unchanged.

  • Set a default image that still represents the brand when a page does not resolve a more specific local image.
  • Use the default 1200 by 630 output when one landscape format fits the campaign and platform mix.
  • Review the resize mode and background color against transparent-packshot and portrait product imagery.
  • Expect only normalized local Magento media paths to be transformed and cached.
  • Use the admin cache action after a deliberate image correction when generated Open Graph images need to be cleared.

Choose one authority for overlapping social tags

A Magento theme or another extension may already write Open Graph or Twitter Card tags. The cleanest setup is to disable the other output so each metadata key has one owner. If that is not possible, the module can remove competing Open Graph, product, and enabled Twitter Card tags for keys it generates. The setting is off by default to preserve compatibility.

A safe duplicate-tag rollout

  • Inspect initial storefront HTML for existing og, product, and twitter meta tags.
  • Disable duplicate output at the theme or extension when that option exists.
  • Enable Remove Competing Social Tags only when the remaining source cannot be disabled.
  • Recheck product, category, CMS, and home pages for one intentional value per key.

Use resolved metadata in custom frontends

The module exposes the same normalized metadata through anonymous, read-only REST endpoints for product, category, CMS, and home pages. Its GraphQL fields appear on Magento's native storefront types, including ProductInterface, CategoryInterface, CmsPage, and StoreConfig. Both surfaces return the resolved tag list, so a headless storefront, mobile application, or other custom frontend can use the same metadata as the Magento storefront.

Query resolved product metadata through GraphQL
query ProductOpenGraph($sku: String!) {
  products(filter: { sku: { eq: $sku } }) {
    items {
      sku
      open_graph {
        enabled
        tags {
          name
          content
        }
      }
    }
  }
}

Launch with a small, repeatable quality check

Before a campaign or catalog release

  • Open a representative product, category, CMS, and home page for every important store view.
  • Confirm the canonical URL, title, description, image, width, and height values are accurate.
  • Check product price, currency, and availability metadata when product previews use those fields.
  • Confirm Twitter Card tags appear only when the setting is enabled and match the resolved Open Graph values.
  • Use a public inspector to validate the live HTML before a social post or paid campaign goes out.

Check live example pages

Open a ready-made checker result to see the metadata the demo store publishes for each page type.

This workflow keeps the technical metadata and the marketing message aligned. Developers get a predictable resolution path and inspectable output. Marketers get accurate, page-specific previews without needing a separate set of storefront templates for every campaign.

Request a Magento preview audit

We will review three representative public URLs, identify social-preview metadata problems, and reply asynchronously with one practical setup proposal.

We will use these details only to review the requested store and send one setup proposal. You will not be added to recurring marketing. Read the Privacy Policy.

Prefer to continue on your own? Open the free checker

Use the next guide to implement, validate, or scale what you learned here.