{{ $post := .post }}
{{ $heading := .heading | default "h2" }}
{{ $heading_tag := (dict 
    "open" ((printf "<%s itemprop='headline'>" $heading) | safeHTML)
    "close" ((printf "</%s>" $heading) | safeHTML)
    ) }}

{{ with $post }}
<article class="post" itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
  <div class="post-content">
    {{- $title := partial "PrepareHTML" .Title -}}

    {{ $heading_tag.open }}
      <a href="{{ .Permalink }}" title="{{ safeHTML (i18n "commons.more_aria" (dict "Title" $title)) }}">{{ $title }}</a>
    {{ $heading_tag.close }}

    {{ if site.Params.posts.index.show_categories }}
      {{- partial "posts/categories" . -}}
    {{ end }}

    {{- if (partial "GetTextFromHTML" .Params.summary) -}}
      {{ if site.Params.posts.index.truncate_description }}
        <p itemprop="articleBody">{{ partial "GetTruncateContent" ( dict 
          "text" .Params.summary
          "length" site.Params.posts.index.truncate_description
          ) }}</p>
      {{ else }}
        <p itemprop="articleBody">{{ partial "PrepareText" .Params.summary }}</p>
      {{ end }}
    {{- end -}}
    
    <div class="post-meta">
      <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04" }}">{{ .Date | time.Format ":date_long" }}</time>
      {{ if site.Params.posts.index.show_author }}
        {{- partial "posts/author" . -}}
      {{ end }}
    </div>


  </div>
  {{- if .Params.image -}}
    <div class="media">
      {{- partial "commons/image.html"
            (dict
              "image"    .Params.image
              "sizes"    site.Params.image_sizes.sections.posts.item
            ) -}}
    </div>
  {{- else if site.Params.posts.default_image -}}
    <div class="media">
      {{- partial "commons/image-default.html" -}}
    </div>
  {{- end -}}
</article>
{{ end }}