redzuurdesem/themes/desem-swift-theme/layouts/partials/excerpt.html

34 lines
1013 B
HTML

{{- $scratch := newScratch }}
{{- if isset .Params "image" }}
{{- $scratch.Set "image" .Params.image }}
{{- else }}
{{- if isset .Params "featured_image" }}
{{- $scratch.Set "image" .Params.featured_image }}
{{- else }}
{{ $scratch.Set "image" "thumbnail.svg" }}
{{- end }}
{{- end }}
{{- $image := $scratch.Get "image" }}
{{- $bg := ( $image | absLangURL) }}
<li class = 'post_item'>
<a class = 'post_card' href='{{ .RelPermalink }}' title = '{{ .Title }}'>
<img loading="lazy" src="{{ $bg }}" alt="Thumbnail {{ .Title }}">
</a>
<div class = 'excerpt'>
<div class = 'excerpt_meta'>
{{- with .Params.tags -}}
{{- range first 1 . }}
{{- $tag := . | urlize }}
<a href = '{{ absURL (printf "tags/%s" $tag) }}' class = 'post_tag'>
{{- . }}
</a>
{{- end }}
{{- end }}
</div>
<h3 class = 'post_link'>
<a href='{{ .RelPermalink }}'>{{ .Title }}</a>
</h3>
<p class = 'pale'>{{ .Summary | truncate 90 }}</p>
</div>
</li>