Hugo-theme-stack/layouts/partials/article/components/header.html

20 lines
895 B
HTML
Raw Normal View History

<header class="article-header">
{{ $image := partial "helper/image" (dict "Context" . "Type" "article") }}
{{ if $image.exists }}
<div class="article-image">
2020-09-11 10:01:01 -04:00
{{ if $image.resource }}
{{- $tablet := $image.resource.Resize "1024x" -}}
{{- $desktop := $image.resource.Resize "2000x" -}}
<img srcset="{{ $tablet.RelPermalink }} 1024w, {{ $desktop.RelPermalink }} 2000w"
2020-09-11 10:01:01 -04:00
src="{{ $desktop.RelPermalink }}" width="{{ $image.resource.Width }}" height="{{ $image.resource.Height }}" loading="lazy"
alt="Featured image of post {{ .Title }}" />
{{ else }}
2020-09-11 10:01:01 -04:00
<img src="{{ $image.permalink }}" loading="lazy" alt="Featured image of post {{ .Title }}" />
{{ end }}
</div>
{{ end }}
{{ partial "article/components/details" . }}
</header>