{% extends "base.html" %}

{%block title %}
<title>{{ page.title }} - {{ config.title }}</title>
{% endblock title %}

{%block seo %}
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [{
        "@type": "ListItem",
        "position": 1,
        "item": {
          "@id": "{{ config.base_url }}",
          "name": "home"
        }
    },{
        "@type": "ListItem",
        "position": 3,
        "item": {
          "@id": "{{ page.permalink }}",
          "name": "{{ page.title }}"
        }
    }]
}
</script>
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Article",
  "author": {
    "name" : "{{ page.extra.author }}"
  },
  "headline": "{{ page.title }}",
	"description" : "{% if page.description %}{{ page.description | striptags }}{% elif page.summary %}{{ page.summary | striptags  }}{% else %}{{ page.content | striptags | truncate(length=250)}}{% endif %}",
  "inLanguage" : "{{ lang }}",
  "wordCount": {{ page.word_count }},
  "datePublished" : "{{ page.date | date(format="%Y-%m-%d") }}",
{% if page.updated %}
  "dateModified" : "{{ page.updated | date(format="%Y-%m-%dT") }}",
{% endif %}
  "image" : "{{ get_url(path=page.extra.image) }}",
{% if page.taxonomies.t %}
	"keywords" : [ "{{ page.taxonomies.t }}" ],
{% endif %}
  "mainEntityOfPage" : "{{ page.permalink }}",
  "publisher" : {
    "@type": "Organization",
    "name" : "{{ config.base_url }}",
    "logo" : {
        "@type" : "ImageObject",
        "url" : "{{ get_url(path=config.extra.logo) }}",
        "height" :  60 ,
        "width" :  60
    }
  }
}
</script>

<!-- Facebook Meta Tags -->
<meta property="og:url" content="{{ page.permalink }}">
<meta property="og:type" content="website">
<meta property="og:title" content="{{ page.title }}">
<meta property="og:description" content="{% if page.description %}{{ page.description | striptags }}{% elif page.summary %}{{ page.summary | striptags  }}{% else %}{{ page.content | striptags | truncate(length=250)}}{% endif %}">
<meta property="og:image" content="{{ get_url(path=page.extra.image) }}">

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="{{ config.base_url }}">
<meta property="twitter:url" content="{{ page.permalink }}">
<meta name="twitter:title" content="{{ page.title }}">
<meta name="twitter:description" content="{% if page.description %}{{ page.description | striptags }}{% elif page.summary %}{{ page.summary | striptags  }}{% else %}{{ page.content | striptags | truncate(length=250)}}{% endif %}">
<meta name="twitter:image" content="{{ get_url(path=page.extra.image) }}">

{% endblock seo%}

{%block header %}
<div class="heading">
	<h1>{{ page.title }}</h1>
	<span class="post-meta">
		<span class="fa fa-calendar"></span>&nbsp;{{ trans(key="postedOnDate",lang=lang)}} {{ page.date | date(format=trans(key="dateFormat",lang=lang),locale=trans(key="locale",lang=lang)) }} {{ trans(key="postedBy",lang=lang)}} {{ page.extra.author }}
		{% if page.updated %}
			&nbsp;({{ trans(key="lastModified",lang=lang) }} {{ page.updated }})
		{% endif %}
		{% if page.translations -%}
			{% for translation in page.translations %}
				{% if translation.lang != lang %}
					&bullet;&nbsp;
					<a href="{{ translation.permalink }}">{{ translation.lang }}</a>
				{% endif %}
			{% endfor %}
		{%- endif %}
	</span>
</div>
{% endblock header%}

{% block main %}
<article role="main" class="blog-post wrapper">
	{{ page.content | safe }}

	{% if page.taxonomies.t %}
	<div class="blog-tags">
		{% for tag in page.taxonomies.t | sort %}
		{% set tag_slug = tag | slugify %}
		<a href="{{ get_url(path="/t/" ~ tag_slug) }}">{{ tag }}</a>&nbsp;
		{% endfor %}
	</div>
	{% endif %}
</article>

<div class="wrapper">
	<nav class="pagination" role="navigation" aria-label="navigation">
		{% if page.higher %}
		<a class="pagination-previous" href="{{ page.higher.permalink }}">
			&larr;{{ trans(key="previousPost",lang=lang) }}
		</a>
		{% else %}
		<a class="pagination-previous" disabled>
			&larr;{{ trans(key="previousPost",lang=lang) }}
		</a>
		{% endif %}
		{% if page.lower %}
		<a class="pagination-next" href="{{ page.lower.permalink }}">
			{{ trans(key="nextPost",lang=lang) }} &rarr;
		</a>
		{% else %}
		<a class="pagination-next" disabled>
			{{ trans(key="nextPost",lang=lang) }} &rarr;
		</a>
		{% endif %}
	</nav>
</div>
{% endblock main %}
