<!-- OPEN GRAPH BEGINNING -->
{% if post.imageSocialMedia is defined and post.imageSocialMedia is not null and post.imageSocialMedia|length > 0 %}
{% set image_social_media = post.imageSocialMedia %}
{% else %}
{% if letstalkType == 'site' %}
{% set image_social_media = 'defaut-site.webp' %}
{% elseif letstalkType == 'seo' %}
{% set image_social_media = 'defaut-seo.webp' %}
{% else %}
{% set randomType = random(['site', 'seo']) %}
{% set image_social_media = 'defaut-' ~ randomType ~ '.webp' %}
{% endif %}
{% endif %}
{% set currentRoute = app.request.attributes.get('_route') %}
{% set og_type = currentRoute == 'show_post' ? 'article' : 'website' %}
{% set image_social_media_height = currentRoute == 'show_post' ? '630' : '1200' %}
<meta property="og:locale" content="fr_FR">
<meta property="og:title" content="{{ title_tag }}"/>
<meta property="og:type" content="{{og_type}}"/>
<meta property="og:description" content="{{ description_tag}}"/>
<meta property="og:url" content="{{canonical_url}}">
<meta property="og:site_name" content="Refined web">
<meta property="og:image" content="{% block og_image %}{{ absolute_url(asset('images/social-medias/' ~ image_social_media)) }}{% endblock %}">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="{{image_social_media_height}}">
{% if og_type == 'article'%}
{% if post.publishedOn is defined and post.publishedOn|date('c') is not null %}
<meta property="og:article:published_time" content="{{post.publishedOn|date('c')}}">
<meta property="og:article:modified_time" content="{{post.updatedAt|date('c')}}">
<meta property="og:updated_time" content="{{post.updatedAt|date('c')}}">
{% endif %}
{% if post.author.name is defined and post.author.name is not null %}
<meta property="og:article:author" content="{{post.author.name}}">
{% endif %}
{% if post.blogHome.title is defined and post.blogHome.title is not null %}
<meta property="og:article:section" content="{{post.blogHome.title}}">
{% endif %}
{% endif %}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:creator" content="@refinedwebfr">
<meta name="twitter:site" content="@refinedwebfr">
<meta name="twitter:image" content="{{ block('og_image') }}">
<!-- <meta property="fb:app_id" content=""> -->
<!-- OPEN GRAPH END -->