hook_test/layouts/partials/li_card.html
2021-12-31 12:44:26 +01:00

81 lines
2.5 KiB
HTML

{{ $item := . }}
{{ $microdata_type := "CreativeWork" }}
{{ $show_buttons := false }}
{{/* Dynamic view adjusts to content type. */}}
{{ if eq $item.Type "post" }}
{{ $microdata_type = "BlogPosting" }}
{{ else if eq $item.Type "talk" }}
{{ $microdata_type = "Event" }}
{{ $show_buttons = true }}
{{ else if eq $item.Type "publication" }}
{{ $microdata_type = "ScholarlyArticle" }}
{{ $show_buttons = true }}
{{ end }}
{{/* Get summary. */}}
{{ $summary := "" }}
{{ if $item.Params.summary }}
{{ $summary = $item.Params.summary | markdownify | emojify }}
{{ else if .Params.abstract }}
{{ $summary = .Params.abstract | markdownify | emojify }}
{{ else if $item.Truncated }}
{{ $summary = $item.Summary }}
{{ else }}
{{ $summary = $item.Content }}
{{ end }}
<div class="card-simple" itemscope itemtype="http://schema.org/{{$microdata_type}}">
{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
{{ $anchor := $item.Params.image.focal_point | default "Smart" }}
{{ with $resource }}
{{ $image := .Fill (printf "918x517 q90 %s" $anchor) }}
<a href="{{ $item.RelPermalink }}">
<img src="{{ $image.RelPermalink }}" class="article-banner" itemprop="image" alt="">
</a>
{{end}}
<div class="card-body">
<h3 class="article-title mb-1 mt-0" itemprop="name">
<a href="{{ $item.RelPermalink }}" itemprop="url">{{ $item.Title }}</a>
</h3>
{{ if eq $item.Type "talk" }}
<div class="article-metadata">
{{ if $item.Params.authors }}
<div itemprop="author">
{{ partial "page_metadata_authors" $item }}
</div>
{{ end }}
<span itemprop="startDate">
{{ $date := $item.Date }}
{{ (time $date).Format site.Params.date_format }}
{{ if not $item.Params.all_day }}
{{ (time $date).Format (site.Params.time_format | default "3:04 PM") }}
{{ with $item.Params.date_end }}
&mdash; {{ (time .).Format (site.Params.time_format | default "3:04 PM") }}
{{ end }}
{{ end }}
</span>
{{ with $item.Params.location }}
<span class="middot-divider"></span>
<span itemprop="location">{{ . }}</span>
{{ end }}
</div>
{{ else }}
{{ partial "page_metadata" (dict "page" $item "is_list" 1) }}
{{ end }}
{{ with $summary }}
<div class="article-style" itemprop="articleBody">
{{ . }}
</div>
{{ end }}
{{ if $show_buttons }}
<div class="btn-links">
{{ partial "page_links" (dict "page" $item "is_list" 1) }}
</div>
{{ end }}
</div>
</div>