card.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {{ $item := .item }}
  2. {{/* Dynamic view adjusts to content type. */}}
  3. {{ $has_attachments := partial "functions/has_attachments" . }}
  4. {{ $link := $item.RelPermalink }}
  5. {{ $target := "" }}
  6. {{ if $item.Params.external_link }}
  7. {{ $link = $item.Params.external_link }}
  8. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  9. {{ end }}
  10. {{/* Get summary. */}}
  11. {{ $summary := "" }}
  12. {{ if $item.Params.summary }}
  13. {{ $summary = $item.Params.summary | markdownify | emojify }}
  14. {{ else if .Params.abstract }}
  15. {{ $summary = .Params.abstract | markdownify | emojify }}
  16. {{ else if $item.Summary }}
  17. {{ $summary = $item.Summary }}
  18. {{ end }}
  19. <div class="card-simple view-card">
  20. {{ if eq $item.Type "event" }}
  21. <div class="article-metadata">
  22. {{ if $item.Params.authors }}
  23. <div>
  24. {{ partial "page_metadata_authors" $item }}
  25. </div>
  26. {{ end }}
  27. <span>
  28. {{ partial "functions/get_event_dates" $item }}
  29. </span>
  30. {{ with $item.Params.location }}
  31. <span class="middot-divider"></span>
  32. <span>{{ . }}</span>
  33. {{ end }}
  34. </div>
  35. {{ else }}
  36. {{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
  37. {{ end }}
  38. {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
  39. {{ $anchor := $item.Params.image.focal_point | default "Smart" }}
  40. {{ with $resource }}
  41. {{ $image := .Fill (printf "808x455 webp %s" $anchor) }}
  42. <a href="{{ $link }}" {{ $target | safeHTMLAttr }}>
  43. <div class="img-hover-zoom">
  44. <img src="{{ $image.RelPermalink }}" height="{{ $image.Height }}" width="{{ $image.Width }}"
  45. class="article-banner" alt="{{ $item.Title }}" loading="lazy">
  46. </div>
  47. </a>
  48. {{end}}
  49. <div class="section-subheading article-title mb-1 mt-3">
  50. <a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
  51. </div>
  52. {{ with $summary }}
  53. <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="summary-link">
  54. <div class="article-style">
  55. <p>{{.}}</p>
  56. </div>
  57. </a>
  58. {{ end }}
  59. {{ if $has_attachments }}
  60. <div class="btn-links">
  61. {{ partial "page_links" (dict "page" $item "is_list" 1) }}
  62. </div>
  63. {{ end }}
  64. </div>