{{ $ := .root }}
{{ $page := .page }}
{{ $count := len (where $.Site.RegularPages "Type" "talk") }}

<!-- Talks widget -->
<div class="row">
  <div class="col-12 col-lg-4 section-heading">
    <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
    {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
  </div>
  <div class="col-12 col-lg-8">
    {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}

    {{ $talks := where $.Site.RegularPages "Type" "talk" }}

    {{/* Exclude talks shown in Featured Talks widget? */}}
    {{ if $page.Params.exclude_featured }}
      {{ $talks = (where $talks ".Params.featured" "!=" true) }}
    {{ end }}

    {{ range first $page.Params.count (sort $talks ".Params.time_start" "desc") }}
      {{ if eq $page.Params.view 1 }}
        {{ partial "talk_li_list" . }}
      {{ else if eq $page.Params.view 3 }}
        {{ partial "talk_li_card" . }}
      {{ else }}
        {{ partial "talk_li_compact" . }}
      {{ end }}
    {{ end }}

    {{ if gt $count $page.Params.count }}
    <div class="see-all">
      <a href="{{ ($.Site.GetPage "section" "talk").RelPermalink }}">
      {{ i18n "more_talks" | markdownify }}
      <i class="fas fa-angle-right"></i>
      </a>
    </div>
    {{ end }}

  </div>
</div>
