tobiasolssonse
9/15/2017 - 8:32 AM

facebook og

facebook og timber wordpress

<!-- Facebook Open Graph -->
{% set facebookdesc = '' %}
{% set facebookimg = '' %}
{% set facebooktitle = '' %}

{% if post.post_type == 'page' %}
  {% if fn('is_front_page') %}
    {% set facebooktitle = site.name %}
  {% else %}
    {% set facebooktitle = post.title %}
  {% endif %}
  {% for enmodul in post.get_field('modulsystem') %}
      {% if enmodul.acf_fc_layout == 'ma' %}
        {% set facebookdesc = enmodul.text|striptags %}
        {% set facebookimg = TimberImage(enmodul.bild).src|resize(600,315) %}
      {% endif %}
  {% endfor %}
{% else %}
  {% set facebookdesc = post.content|striptags %}
  {% set facebookimg = post.thumbnail.src|resize(600) %}
  {% set facebooktitle = post.title  %}
{% endif %}

<meta property="og:locale" content="sv_SE">
<meta property="og:site_name" content="{{site.title}}">
<meta property="og:title" content="{{facebooktitle}}">
<meta property="og:url" content="{{site.url}}/{{post.slug}}/">
<meta property="og:type" content="website">
<meta property="og:description" content="{{facebookdesc}}">
<meta property="og:image" content="{{facebookimg}}">
<!-- Google+ / Schema.org -->
<meta itemprop="name" content="{{facebooktitle}}">
<meta itemprop="description" content="{{facebookdesc}}">
<meta itemprop="image" content="{{facebookimg}}">
<!-- Twitter Cards -->
<meta name="twitter:title" content="{{facebooktitle}}">
<meta name="twitter:url" content="{{site.url}}/{{post.slug}}//">
<meta name="twitter:description" content="{{facebookdesc}}">
<meta name="twitter:image" content="{{facebookimg}}">
<meta name="twitter:card" content="summary_large_image">
<!-- SEO -->
<meta name="description" content="{{fascebokdesc}}">
<!-- Misc. tags -->
<!-- END - Facebook Open Graph, Google+ and Twitter Card Tags 2.0.9 -->