chameleon-system-private/open-graph-meta-data-bundle

8.0.45 2025-12-15 13:48 UTC

README

The Open Graph Meta Data Bundle provides support for Open Graph tags for Chameleon on pages. It can be extended to support more content.

Installation

Normal dependency requirement in composer.json and adding to AppKernel.

There is now a field og_social_image in cms_portal. This should be set to a meaningful (not too small) image representing the project. It will be used as a fallback for og:image if neither other source provides an image. The image size used here is currently 1200x630.

NOTE that the meta-data-bundle changes the handling of some of the normal meta data (title, description, ...).

Extension

To support other content than pages and articles there is a two-tier mechanism to add more:

1. Add a meta data modifier

You can add a service class tagged with chameleon_system_meta_data.modifier from the meta-data-bundle. See for an example: \ChameleonSystem\OpenGraphMetaDataBundle\Service\OpenGraphTagsFallbackPageMetaModifier. Please note the priority on those services. Higher priorities will be considered later and thus can overwrite existing tags.

2. Add database fields

In case you want to add og tag fields to an existing table you can connect that two-way to the table cms_meta_data. See file update-1612515576.inc.php for an example.

This then needs additionally a modifier service as described above. See \ChameleonSystem\OpenGraphMetaDataBundle\Service\OpenGraphTagsFromPageMetaModifier for an example.

This modifier will normally also need a data access as dependency which simply references a generic class of the meta-data-bundle: ChameleonSystem\MetaDataBundle\Bridge\Chameleon\DataAccess\MetaDataDataAccess. For example:

<service id="chameleon_system_open_graph_meta_data.access.meta_for_pages" class="ChameleonSystem\MetaDataBundle\Bridge\Chameleon\DataAccess\MetaDataDataAccess" public="false">
    <argument>cms_tpl_page_id</argument>
</service>