hugo-theme-stack/layouts/partials/article/components/header.html
2020-09-10 18:53:36 +02:00

20 lines
No EOL
824 B
HTML

<header class="article-header">
{{ $image := partial "helper/image" . }}
{{ if $image.exists }}
<div class="article-image">
{{ if $image.local }}
{{- $tablet := $image.src.Resize "1024x" -}}
{{- $desktop := $image.src.Resize "2000x" -}}
<img srcset="{{ $tablet.RelPermalink }} 1024w, {{ $desktop.RelPermalink }} 2000w"
src="{{ $desktop.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy"
alt="Featured image of post {{ .Title }}" />
{{ else }}
<img src="{{ $image.src }}" loading="lazy" alt="Featured image of post {{ .Title }}" />
{{ end }}
</div>
{{ end }}
{{ partial "article/components/details" . }}
</header>