compact.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {{ $item := .item }}
  2. {{/* Dynamic view adjusts to content type. */}}
  3. {{ $show_authors_only := false }}{{/* Show authors only or full metadata? */}}
  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. {{ if eq $item.Type "event" }}
  11. {{ $show_authors_only = true }}
  12. {{ else if eq $item.Type "publication" }}
  13. {{ $show_authors_only = true }}
  14. {{ else if eq $item.Type "project" }}
  15. {{ $show_authors_only = true }}
  16. {{ end }}
  17. {{ $has_attachments := partial "functions/has_attachments" . }}
  18. {{/* Get summary. */}}
  19. {{ $summary := "" }}
  20. {{ if $item.Params.summary }}
  21. {{ $summary = $item.Params.summary | markdownify | emojify }}
  22. {{ else if .Params.abstract }}
  23. {{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
  24. {{ else if $item.Summary }}
  25. {{ $summary = $item.Summary }}
  26. {{ end }}
  27. <div class="media stream-item view-compact">
  28. <div class="media-body">
  29. <div class="section-subheading article-title mb-0 mt-0">
  30. <a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
  31. </div>
  32. {{ with $summary }}
  33. <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="summary-link">
  34. <div class="article-style">
  35. {{.}}
  36. </div>
  37. </a>
  38. {{ end }}
  39. <div class="stream-meta article-metadata">
  40. {{ if eq $item.Type "event" }}
  41. <div>
  42. <span>
  43. {{ partial "functions/get_event_dates" $item }}
  44. </span>
  45. {{ with $item.Params.location }}
  46. <span class="middot-divider"></span>
  47. <span>{{ . }}</span>
  48. {{ end }}
  49. </div>
  50. {{ end }}
  51. {{ if and $show_authors_only $item.Params.authors }}
  52. <div>
  53. {{ partial "page_metadata_authors" $item }}
  54. </div>
  55. {{ else if not $show_authors_only }}
  56. {{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
  57. {{ end }}
  58. </div>
  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>
  65. <div class="ml-3">
  66. {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
  67. {{ with $resource }}
  68. {{ $image := .Resize "150x webp" }}
  69. <a href="{{$link}}" {{ $target | safeHTMLAttr }}>
  70. <img src="{{ $image.RelPermalink }}" height="{{ $image.Height }}" width="{{ $image.Width }}"
  71. alt="{{ $item.Title }}" loading="lazy">
  72. </a>
  73. {{end}}
  74. </div>
  75. </div>