freyjaskiss.com/themes/mainroad/layouts/partials/post_thumbnail.html

19 lines
807 B
HTML

{{- if $thumbnail := .page.Params.thumbnail }}
{{- $class := .class }}
{{- $visibility := .page.Site.Params.thumbnail.visibility | default (slice "list" "post") }}
{{- $valueType := printf "%T" $thumbnail -}}
{{- $isMap := in $valueType "map" -}}
{{- if $isMap }}
{{ $visibility = default (slice "list" "post") (default .page.Site.Params.thumbnail.visibility $thumbnail.visibility) }}
{{ $thumbnail = $thumbnail.src }}
{{- end }}
{{- if in $visibility $class }}
<figure class="{{ with $class }}{{ . }}__thumbnail {{ end }}thumbnail">
{{ if eq $class "list" }}<a class="thumbnail__link" href="{{ .page.RelPermalink }}">{{ end }}
<img class="thumbnail__image" src="{{ $thumbnail | relURL }}" alt="{{ .page.Title }}">
{{ if eq $class "list" }}</a>{{ end }}
</figure>
{{- end }}
{{- end }}