li_compact.html 2.7 KB

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