# mosaicora/module-opengraph

> Open Graph and Twitter Card metadata module for Magento 2, Mage-OS, and Adobe Commerce, with image optimization, REST, and GraphQL APIs

`composer require mosaicora/module-opengraph`

Canonical URL: https://packagento.com/mosaicora/module-opengraph

## At a glance

- **Vendor**: mosaicora (https://packagento.com/mosaicora.md)
- **Latest version**: v1.1.1 — released 2026-07-22
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/mosaicora/module-opengraph and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require mosaicora/module-opengraph:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Open Graph and Twitter Card metadata module for Magento 2, Mage-OS, and Adobe Commerce, with image optimization, REST, and GraphQL APIs

## README

Open Graph and Twitter Card metadata module for Magento 2, Mage-OS, and Adobe Commerce storefronts.

### Mosaicora CDN and JSON-LD

Mosaicora is an optional integration that generates social-preview images from
your storefront pages and serves them through the Mosaicora CDN. When it isn't
enabled, the module continues using its normal Open Graph image handling.

To enable it, create a Mosaicora.io account, create a site in the
[Mosaicora Dashboard](https://dash.mosaicora.io/), then enter that site's ID
at **Stores > Configuration > Mosaicora > Open Graph**.

JSON-LD mappings provide image-generation hints and are active only when
Mosaicora is enabled.

See the [Advanced Configuration documentation](https://mosaicora.io/documentation/advanced-configuration)
for supported Mosaicora JSON-LD semantic roles and mapping values.

`mosaicora/module-opengraph` gives product, category, CMS, and home pages the metadata that social platforms need to generate clean share previews. It works out of the box with sensible defaults, while still giving store teams per-store control over titles, descriptions, images, and generated social-preview image sizes.

### Live Demo

A Magento demo shop configured with this module is available at <https://demo-shop-magento.mosaicora.io/>.

Use the free Mosaicora Open Graph Checker at <https://mosaicora.io/tools/open-graph-checker> to inspect the shop's Open Graph tags and preview how its pages will appear when shared. Try these ready-made examples:

- [Preview the Bags category](https://mosaicora.io/tools/open-graph-checker?url=https%3A%2F%2Fdemo-shop-magento.mosaicora.io%2Fgear%2Fbags.html)
- [Preview the Joust Duffle Bag](https://mosaicora.io/tools/open-graph-checker?url=https%3A%2F%2Fdemo-shop-magento.mosaicora.io%2Fjoust-duffle-bag.html)
- [Preview the Voyage Yoga Bag](https://mosaicora.io/tools/open-graph-checker?url=https%3A%2F%2Fdemo-shop-magento.mosaicora.io%2Fvoyage-yoga-bag.html)

### Why Use It

- Adds Open Graph metadata across common storefront page types.
- Mirrors Open Graph values into optional Twitter Card tags.
- Lets admins choose title, description, and image sources without template changes.
- Supports custom Open Graph images for categories and CMS pages.
- Generates cached `1200x630` social-preview images from local Magento media assets by default.
- Provides an admin cache action for flushing generated Open Graph images.

### Supported Pages

The module resolves the active storefront context and applies metadata during layout generation.

- Product pages use the current product.
- Category pages use the current category on `catalog_category_view`.
- CMS pages use the active CMS page captured during render.
- The home page uses the current CMS home page when available, otherwise it falls back to the configured site name and default image.

### Requirements

- PHP `~8.1` to `~8.5`
- Magento 2, Mage-OS, or Adobe Commerce with the Catalog, CMS, Store, Web API, and GraphQL modules enabled.
- Composer credentials for `repo.magento.com` when installing Magento packages directly.

### Installation

Install the package through Composer:

```bash
composer require mosaicora/module-opengraph
```

Run the normal Magento upgrade and cache workflow:

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

For production-mode deployments, also regenerate dependency injection and static content according to the store's deployment process:

```bash
bin/magento setup:di:compile
bin/magento setup:static-content:deploy
```

Install dependencies from the Magento project root. Do not run `composer install` inside a module directory mounted or symlinked into Magento because a nested `vendor/` tree causes duplicate class loading during compilation.

### Configuration

The module adds a configuration section at:

`Stores > Configuration > Mosaicora > Open Graph`

Configuration is store-scoped where Magento allows it, so each store view can use its own site name, default image, metadata source attributes, and image optimization settings.

#### General

- `Enable Open Graph Tags`
- `Site Name`
- `Default Image`
- `Enable Twitter Card Tags`
- `Twitter Card Type`
- `Remove Competing Social Tags`

`Remove Competing Social Tags` is disabled by default. When enabled, Mosaicora removes duplicate Open Graph,
product, and enabled Twitter Card tags for metadata keys that this module generates, so Mosaicora's values win.

#### Image Optimization

- `Serve Optimized OG Image`
- `Width`
- `Height`
- `Resize Mode`
- `Background Color`

Image optimization is enabled by default and uses `1200x630`, the common Open Graph share-card aspect ratio. Local Magento media images can be converted into cached social-preview images. External image URLs are left unchanged.

#### Content Defaults

- Product title, description, and image attribute sources.
- Category title and description attribute sources.
- CMS title and description field sources.

Individual products, categories, and CMS pages can also provide Open Graph-specific values when the module attributes or fields are available.

### Metadata Output

The module can output:

- `og:type`
- `og:url`
- `og:site_name`
- `og:title`
- `og:description`
- `og:image`
- `og:image:width`
- `og:image:height`
- `twitter:card`
- `twitter:title`
- `twitter:description`
- `twitter:image`

Product pages may also output:

- `product:price:amount`
- `product:price:currency`
- `product:availability` with `instock` or `oos`

Twitter tags are copied from the resolved Open Graph values when Twitter Card output is enabled.

#### Duplicate Social Tags

Magento, themes, and third-party extensions may emit their own Open Graph or Twitter Card tags. The preferred
setup is to disable that output in the other module or theme so only one metadata provider remains active.

_(README truncated for .md surface. Full README on https://packagento.com/mosaicora/module-opengraph.)_

## Changelog

All notable changes to this project will be documented in this file.

The project follows a simple, human-readable release log.

### [1.1.1] - 2026-07-22

- Republished the Mosaicora CDN image generation and JSON-LD metadata release with corrected release metadata.

### [1.1.0] - 2026-07-22

- Added optional Store View Mosaicora CDN image generation for product, category, CMS, and home pages.
- Added Mosaicora JSON-LD image hints with attribute-based mappings and typed REST and GraphQL metadata.
- Redesigned Mosaicora configuration and added the Mosaicora Plugin Core dependency.
- Refactored the Mosaicora boundary to use Magento dependency injection and typed configuration renderers.

### [1.0.3] - 2026-06-13

- Restored Magento 2.4.6 compatibility by removing dependencies on framework APIs introduced in later releases.
- Made social metadata deduplication stateless and safe for long-running application workers.
- Reused loaded CMS home pages in GraphQL resolution and preserved cache identities across supported versions.

### [1.0.2] - 2026-06-12

- Added an optional, store-scoped setting that removes competing social metadata tags and keeps Mosaicora's values.
- Stripped HTML markup from resolved Open Graph and Twitter Card text values.

### [1.0.1] - 2026-06-07

- Fixed custom Open Graph images not being saved on categories.

### [1.0.0] - 2026-06-06

- Open Graph metadata support for product, category, CMS, and home pages.
- Optional Twitter Card metadata support.
- Store-scoped admin configuration for metadata sources and default images.
- Product, category, and CMS entity-level Open Graph fields.
- Strict custom-image resolution and cached local image optimization.
- Anonymous REST and native GraphQL metadata APIs.
- Swagger-compatible service contracts and store-aware canonical URLs.
- Admin upload endpoints and generated image cache management.

[1.0.0]: https://github.com/Mosaicora/module-opengraph/releases/tag/v1.0.0
[1.0.1]: https://github.com/Mosaicora/module-opengraph/releases/tag/v1.0.1
[1.0.2]: https://github.com/Mosaicora/module-opengraph/releases/tag/v1.0.2
[1.0.3]: https://github.com/Mosaicora/module-opengraph/releases/tag/v1.0.3
[1.1.0]: https://github.com/Mosaicora/module-opengraph/releases/tag/v1.1.0
[1.1.1]: https://github.com/Mosaicora/module-opengraph/releases/tag/v1.1.1

## Recent Versions

| Version | Released |
|---|---|
| v1.1.1 | 2026-07-22 |
| v1.1.0 | 2026-07-22 |
| 1.0.3 | 2026-06-12 |
| 1.0.2 | 2026-06-12 |
| 1.0.1 | 2026-06-07 |
| 1.0.0 | 2026-06-05 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | ^103.0 |
| magento/module-backend | ^102.0 |
| magento/module-catalog | ^104.0 |
| magento/module-catalog-graph-ql | ^100.4 |
| magento/module-cms | ^104.0 |
| magento/module-cms-graph-ql | ^100.4 |
| magento/module-config | ^101.2 |
| magento/module-eav | ^102.1 |
| magento/module-graph-ql | ^100.4 |
| magento/module-store | ^101.1 |
| magento/module-store-graph-ql | ^100.4 |
| magento/module-ui | ^101.2 |
| magento/module-webapi | ^100.4 |
| mosaicora/plugin-core-php | ^1.0 |
| php | ~8.1.0\|\|~8.2.0\|\|~8.3.0\|\|~8.4.0\|\|~8.5.0 |

### Require (dev)

| Package | Constraint |
|---|---|
| dealerdirect/phpcodesniffer-composer-installer | ^1.1 |
| magento/magento-coding-standard | ^40.0 |
| phpunit/phpunit | ^10.5 \|\| ^11.5 \|\| ^12.0 |
| squizlabs/php_codesniffer | ^3.10.2 |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["mosaicora/module-opengraph"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

mosaicora is a Magento 2 vendor on Packagento. See https://packagento.com/mosaicora.md for their full catalogue.

