li_compact.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {{ $item := . }}
  2. {{/* Dynamic view adjusts to content type. */}}
  3. {{ $show_authors_only := false }}{{/* Show authors only or full metadata? */}}
  4. {{ $show_buttons := false }}
  5. {{ $link := $item.RelPermalink }}
  6. {{ $target := "" }}
  7. {{ if $item.Params.external_link }}
  8. {{ $link = $item.Params.external_link }}
  9. {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  10. {{ end }}
  11. {{ if eq $item.Type "event" }}
  12. {{ $show_authors_only = true }}
  13. {{ $show_buttons = true }}
  14. {{ else if eq $item.Type "publication" }}
  15. {{ $show_authors_only = true }}
  16. {{ $show_buttons = true }}
  17. {{ else if eq $item.Type "project" }}
  18. {{ $show_authors_only = true }}
  19. {{ $show_buttons = true }}
  20. {{ end }}
  21. {{/* Get summary. */}}
  22. {{ $summary := "" }}
  23. {{ if $item.Params.summary }}
  24. {{ $summary = $item.Params.summary | markdownify | emojify }}
  25. {{ else if .Params.abstract }}
  26. {{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
  27. {{ else if $item.Summary }}
  28. {{ $summary = $item.Summary }}
  29. {{ end }}
  30. <div class="media stream-item">
  31. <div class="media-body">
  32. <h3 class="article-title mb-0 mt-0">
  33. <a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>
  34. </h3>
  35. {{ with $summary }}
  36. <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="summary-link">
  37. <div class="article-style">
  38. {{.}}
  39. </div>
  40. </a>
  41. {{ end }}
  42. <div class="stream-meta article-metadata">
  43. {{ if eq $item.Type "event" }}
  44. <div>
  45. <span>
  46. {{ partial "functions/get_event_dates" $item }}
  47. </span>
  48. {{ with $item.Params.location }}
  49. <span class="middot-divider"></span>
  50. <span>{{ . }}</span>
  51. {{ end }}
  52. </div>
  53. {{ end }}
  54. {{ if and $show_authors_only $item.Params.authors }}
  55. <div>
  56. {{ partial "page_metadata_authors" $item }}
  57. </div>
  58. {{ else if not $show_authors_only }}
  59. {{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
  60. {{ end }}
  61. </div>
  62. {{ if $show_buttons }}
  63. <div class="btn-links">
  64. {{ partial "page_links" (dict "page" $item "is_list" 1) }}
  65. </div>
  66. {{ end }}
  67. </div>
  68. <div class="ml-3">
  69. {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
  70. {{ with $resource }}
  71. {{ $filters := slice (images.GaussianBlur 21) (images.Pixelate 8) }}
  72. {{ $image := .Resize "150x" }}
  73. {{ $image_lq := (.Resize "150x q1").Filter $filters }}
  74. <a href="{{$link}}" {{ $target | safeHTMLAttr }}>
  75. <img src="{{ $image_lq.RelPermalink }}" data-src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" class="lazyload">
  76. </a>
  77. {{end}}
  78. </div>
  79. </div>