li_card.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. {{ partial "functions/get_event_dates" $item }}
  35. </span>
  36. {{ with $item.Params.location }}
  37. <span class="middot-divider"></span>
  38. <span itemprop="location">{{ . }}</span>
  39. {{ end }}
  40. </div>
  41. {{ else }}
  42. {{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
  43. {{ end }}
  44. {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
  45. {{ $anchor := $item.Params.image.focal_point | default "Smart" }}
  46. {{ with $resource }}
  47. {{ $image := .Fill (printf "918x517 q90 %s" $anchor) }}
  48. <a href="{{ $item.RelPermalink }}">
  49. <img src="{{ $image.RelPermalink }}" class="article-banner" itemprop="image" alt="">
  50. </a>
  51. {{end}}
  52. <h3 class="article-title mb-1 mt-3" itemprop="name">
  53. <a href="{{ $item.RelPermalink }}" itemprop="url">{{ $item.Title }}</a>
  54. </h3>
  55. {{ with $summary }}
  56. <div class="article-style" itemprop="articleBody">
  57. <p>{{.}}</p>
  58. </div>
  59. {{ end }}
  60. {{ if $show_buttons }}
  61. <div class="btn-links">
  62. {{ partial "page_links" (dict "page" $item "is_list" 1) }}
  63. </div>
  64. {{ end }}
  65. </div>