{{ $item := . }}

{{/* Dynamic view adjusts to content type. */}}
{{ $icon_pack := "far" }}
{{ $icon := "fa-file-alt" }}
{{ $show_authors := false }}
{{ $show_buttons := false }}
{{ $link := $item.RelPermalink }}
{{ $target := "" }}
{{ if $item.Params.external_link }}
  {{ $link = $item.Params.external_link }}
  {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
{{ if eq $item.Type "post" }}
  {{ $icon = "fa-newspaper" }}
{{ else if eq $item.Type "talk" }}
  {{ $icon = "fa-calendar-alt" }}
{{ else if eq $item.Type "publication" }}
  {{ $show_authors = true }}
  {{ $show_buttons = true }}
{{ else if eq $item.Type "project" }}
  {{ $icon_pack = "fas" }}
  {{ $icon = "fa-project-diagram" }}
  {{ $show_authors = true }}
  {{ $show_buttons = true }}
{{ end }}

<div class="view-list-item">
  <i class="{{$icon_pack}} {{$icon}} pub-icon" aria-hidden="true"></i>
  <a href="{{$link}}" {{ $target | safeHTMLAttr }}>{{ $item.Title }}</a>

  {{ if eq $item.Type "talk" }}
  <div class="article-metadata">
    <span>
      {{ partial "functions/get_event_dates" $item }}
    </span>
    {{ with $item.Params.location }}
    <span class="middot-divider"></span>
    <span>{{ . }}</span>
    {{ end }}
  </div>
  {{ end }}

  {{ if and $show_authors $item.Params.authors }}
  <div class="article-metadata">
    {{ partial "page_metadata_authors" $item }}
  </div>
  {{ end }}

  {{ if $show_buttons }}
  <div class="btn-links">
    {{ partial "page_links" (dict "page" $item "is_list" 1) }}
  </div>
  {{ end }}

</div>
