li_card.html 2.4 KB

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