masonry.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. {{ $item := .item }}
  2. {{ $has_attachments := partial "functions/has_attachments" $item }}
  3. {{ $link := $item.RelPermalink }}
  4. {{ $target := "" }}
  5. {{ if $item.Params.external_link }}
  6. {{ $link = $item.Params.external_link }}
  7. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  8. {{ end }}
  9. {{/* Get summary. */}}
  10. {{ $summary := "" }}
  11. {{ if $item.Params.summary }}
  12. {{ $summary = $item.Params.summary | markdownify | emojify }}
  13. {{ else if .Params.abstract }}
  14. {{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
  15. {{ else if $item.Summary }}
  16. {{ $summary = $item.Summary }}
  17. {{ end }}
  18. {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
  19. <div class="card">
  20. {{ with $resource }}
  21. {{ $image := .Resize "550x webp" }}
  22. <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="card-image hover-overlay">
  23. <img src="{{ $image.RelPermalink }}" height="{{ $image.Height }}" width="{{ $image.Width }}"
  24. alt="{{ $item.Title }}" class="img-responsive" loading="lazy">
  25. </a>
  26. {{ end }}
  27. <div class="card-text">
  28. <h4><a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4>
  29. {{ with $summary }}
  30. <div class="article-style">
  31. <p>{{ . }}</p>
  32. </div>
  33. {{ end }}
  34. {{ if $has_attachments }}
  35. <div class="btn-links">
  36. {{ partial "page_links" (dict "page" $item "is_list" 1) }}
  37. </div>
  38. {{ end }}
  39. </div>
  40. </div>