{% load  i18n static %}
{% load pages_tags thumbnail %}

{% firstof object.seo_title object.title view.title as seo_title %}
{% firstof object.seo_description object.summary object.contents as seo_description %}
{% firstof current_site.site_name django_settings.SITE_NAME as site_name %}

{% current_site as site %}

<title>
  {{ seo_title|title|truncatewords:15 }}
  {% block title_suffix %}
      {% if site %}- {{ site.name|title }}{% endif %}
  {% endblock %}
</title>
<meta name="description" content="{{ seo_description|striptags }}">

{% comment %} Social Card {% endcomment %}
<meta itemprop="name" content="{{ object.title }}"> {# microdata #}
<meta itemprop="description" content="{{ seo_description|striptags }}"> {# microdata #}

<meta property="og:type" content="{{ object.card_type }}"/> {# facebook #}
<meta property="og:url" content="{{ request.build_absolute_uri }}"/> {# facebook #}
<meta property="og:title" content="{{ object.title }}"/> {# facebook #}
<meta property="og:description" content="{{ seo_description|striptags }}"/> {# facebook #}
<meta property="og:locale" content="{{ LANGUAGE_CODE }}"/> {# facebook #}
<meta property="og:site_name" content="{{ site_name }}"/> {# facebook #}

<meta name="twitter:title" content="{{ object.title }}">
<meta name="twitter:url" content="{{ request.build_absolute_uri }}" />
<meta name="twitter:description" content="{{ seo_description|striptags }}" />
<meta name="twitter:creator" content="{{ object.owner }}" />
<meta name="twitter:card" content="{{ object.card_type }}" />
<meta name="twitter:site" content="{{ site.name }}" />

{% if object.thumbnail %}
    {% thumbnail object.thumbnail 96x96 crop as thumb %}
    <meta itemprop="image" content="{{ thumb.url }}">  {# microdata #}
    <meta property="og:image" content="{{ thumb.url }}"/> {# facebook #}
    <meta name="twitter:image:src" content="{{ thumb.url }}"> {# twitter #}
{% endif %}
