li_compact.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {{ $item := . }}
  2. {{ $microdata_type := "CreativeWork" }}
  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. {{/* Dynamic view adjusts to content type. */}}
  12. {{ if eq $item.Type "post" }}
  13. {{ $microdata_type = "BlogPosting" }}
  14. {{ else if eq $item.Type "talk" }}
  15. {{ $microdata_type = "Event" }}
  16. {{ $show_authors_only = true }}
  17. {{ $show_buttons = true }}
  18. {{ else if eq $item.Type "publication" }}
  19. {{ $microdata_type = "ScholarlyArticle" }}
  20. {{ $show_authors_only = true }}
  21. {{ $show_buttons = true }}
  22. {{ else if eq $item.Type "project" }}
  23. {{ $microdata_type = "CreativeWork" }}
  24. {{ $show_authors_only = true }}
  25. {{ $show_buttons = true }}
  26. {{ end }}
  27. {{/* Get summary. */}}
  28. {{ $summary := "" }}
  29. {{ if $item.Params.summary }}
  30. {{ $summary = $item.Params.summary | markdownify | emojify }}
  31. {{ else if .Params.abstract }}
  32. {{ $summary = .Params.abstract | markdownify | emojify }}
  33. {{ else if $item.Truncated }}
  34. {{ $summary = $item.Summary }}
  35. {{ end }}
  36. <div class="media stream-item" itemscope itemtype="http://schema.org/{{$microdata_type}}">
  37. <div class="media-body">
  38. <h3 class="article-title mb-0 mt-0" itemprop="name">
  39. <a href="{{$link}}" {{ $target | safeHTMLAttr }} itemprop="url">{{ $item.Title }}</a>
  40. </h3>
  41. {{ with $summary }}
  42. <div class="article-style" itemprop="articleBody">
  43. {{ . | truncate 135 }}
  44. </div>
  45. {{ end }}
  46. <div class="stream-meta article-metadata">
  47. {{ if eq $item.Type "talk" }}
  48. <div>
  49. <span itemprop="startDate">
  50. {{ partial "functions/get_event_dates" $item }}
  51. </span>
  52. {{ with $item.Params.location }}
  53. <span class="middot-divider"></span>
  54. <span itemprop="location">{{ . }}</span>
  55. {{ end }}
  56. </div>
  57. {{ end }}
  58. {{ if and $show_authors_only $item.Params.authors }}
  59. <div itemprop="author">
  60. {{ partial "page_metadata_authors" $item }}
  61. </div>
  62. {{ else if not $show_authors_only }}
  63. {{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
  64. {{ end }}
  65. </div>
  66. {{ if $show_buttons }}
  67. <div class="btn-links">
  68. {{ partial "page_links" (dict "page" $item "is_list" 1) }}
  69. </div>
  70. {{ end }}
  71. </div>
  72. <div class="ml-3">
  73. {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
  74. {{ with $resource }}
  75. {{ $image := .Resize "150x" }}
  76. <a href="{{$link}}" {{ $target | safeHTMLAttr }}>
  77. <img src="{{ $image.RelPermalink }}" itemprop="image">
  78. </a>
  79. {{end}}
  80. </div>
  81. </div>