li_compact.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {{ $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">
  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" }}
  69. <a href="{{$link}}" {{ $target | safeHTMLAttr }}>
  70. <img src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" loading="lazy">
  71. </a>
  72. {{end}}
  73. </div>
  74. </div>