{{ $item := .item }}
{{ $has_attachments := partial "functions/has_attachments" $item }}

{{ $link := $item.RelPermalink }}
{{ $target := "" }}
{{ if $item.Params.external_link }}
  {{ $link = $item.Params.external_link }}
  {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}

{{/* Get summary. */}}
{{ $summary := "" }}
{{ if $item.Params.summary }}
  {{ $summary = $item.Params.summary | markdownify | emojify }}
{{ else if $item.Params.abstract }}
  {{ $summary = $item.Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
{{ else if $item.Summary }}
  {{ $summary = $item.Summary }}
{{ end }}

{{ $resource := partial "functions/get_featured_image.html" $item }}

<div class="card">
  {{ with $resource }}
  {{ $image := .Resize "550x webp" }}
  <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="card-image hover-overlay">
    <img src="{{ $image.RelPermalink }}" height="{{ $image.Height }}" width="{{ $image.Width }}"
         alt="{{ $item.Title }}" class="img-responsive" loading="lazy">
  </a>
  {{ end }}
  <div class="card-text">
    <!-- <p>{{ . }}</p> -->
    <h4><a href="{{ $link }}" class='animation-title' {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4>

    <video width="848" height="480" controls  autoplay loop  muted >
      <source src="{{ $item.Params.animation }}" type="video/mp4">
    </video>

    {{ with $summary }}
    <div class="article-style">
      <p>{{ . }}</p>
    </div>
    {{ end }}

    {{ if $has_attachments }}
    <div class="btn-links">
      {{ partial "page_links" (dict "page" $item "is_list" 1) }}
    </div>
    {{ end }}
  </div>
</div>
