fond-of-spryker / open-graph
Implementation of the Facebook Open Graph protocol for Spryker
Installs: 18 602
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- spryker/kernel: ^3.0.0
- spryker/product: ^6.0.0
Requires (Dev)
- codeception/codeception: ^2.3
- mikey179/vfsstream: ^1.6
- phpro/grumphp: ^0.14
- sebastian/phpcpd: ^4.0
- spryker/code-sniffer: ^0.11
- spryker/development: ^3.6
This package is auto-updated.
Last update: 2024-12-20 12:28:31 UTC
README
A Basic implementation of the Facebook Open Graph protocol for Spryker
Installation
composer require fond-of-spryker/open-graph
1. Enable the Module in the configuration file
// ---------- Google Tag Manager
$config[OpenGraphConstants::ENABLED::ENABLED] = true;
2. Add Product Image Property Configurations in the configuration file
$config[OpenGraphConstants::PRODUCT_IMAGE_SET] = 'default';
$config[OpenGraphConstants::PRODUCT_IMAGE_URL_TYPE] = 'externalUrlLarge';
3. Add twig service provider to YvesBootstrap.php in registerServiceProviders()
$this->application->register(new OpenGraphTwigServiceProvider());
4. Add the Twig Extension in the neccessary Twig Templates
Application/layout/layout.twig
between <head></head> tags
{# Open Graph Protocol for Facebook and SEO #}
{% block opengraph %}
{% set params = {
'title': 'global.shop.title' | trans,
'description': '',
'url': app.request.uri,
'type': 'website',
'site_name': app.locale | slice(0, 2)
}
%}
{{ openGraph(params)}}
{% endblock %}
Catalog/catalog/index.twig
{% block opengraph %}
{% set params = {
'title': category.name,
'description': '',
'url': app.request.uri,
'type': 'website',
'site_name': '....'
}
%}
{{ openGraph(params)}}
{% endblock %}
Product/product/detail.twig
{% block opengraph %}
{% set params = {
'title': product.name,
'description': product.description,
'url': app.request.uri,
'type': 'product',
'site_name': '...',
'product': product
}
%}
{{ openGraph(params)}}
{% endblock %}