- Ibexa Platform 4.0+
Run the following command from your project root to install the bundle:
$ composer require netgen/open-graph-bundle
Activate the Netgen\Bundle\OpenGraphBundle\NetgenOpenGraphBundle
bundle in config/bundles.php
file.
Add the following in your pagelayout template to output the Open Graph meta tags:
{% if content is defined %}
{{ render_netgen_open_graph(content) }}
{% endif %}
Alternatively, you can use get_netgen_open_graph(content)
to just return the tags
and render them manually, for example:
{% if content is defined %}
{% set meta_tags = get_netgen_open_graph(content) %}
{% for meta_tag in meta_tags %}
<meta property="{{ meta_tag.tagName|trim }}" content="{{ meta_tag.tagValue|trim }}" />
{% endfor %}
{% endif %}