2021-04-27 14:44:35 -07:00
|
|
|
{{ $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }}
|
2021-02-20 12:39:31 -08:00
|
|
|
{{ $customAlt := .Get "alt" }}
|
|
|
|
{{ $customSize := .Get "size" }}
|
|
|
|
{{ $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.Get "lazy") }}
|
|
|
|
|
|
|
|
{{ with $source }}
|
|
|
|
{{ $caption := default .Title $customAlt }}
|
|
|
|
|
|
|
|
{{ $tiny := (.Resize "320x").RelPermalink }}
|
|
|
|
{{ $small := (.Resize "600x").RelPermalink }}
|
|
|
|
{{ $medium := (.Resize "1200x").RelPermalink }}
|
|
|
|
{{ $large := (.Resize "1800x").RelPermalink }}
|
|
|
|
|
|
|
|
{{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }}
|
|
|
|
|
|
|
|
<div class="flex justify-center">
|
|
|
|
<figure class="gdoc-markdown__figure">
|
2021-02-21 05:04:40 -08:00
|
|
|
<a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
|
2021-04-27 14:44:35 -07:00
|
|
|
<picture>
|
2021-06-02 08:26:13 -07:00
|
|
|
<source {{ with $customSize }}srcset="{{ index $size $customSize }}"{{ else }}srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"{{ end }} />
|
|
|
|
<img {{ if $lazyLoad }}loading="lazy" {{ end }}src="{{ $size.large }}" alt="{{ $caption }}" />
|
2021-04-27 14:44:35 -07:00
|
|
|
</picture>
|
2021-02-20 12:39:31 -08:00
|
|
|
</a>
|
2021-06-02 08:26:13 -07:00
|
|
|
{{ with $caption -}}
|
2021-02-21 05:27:54 -08:00
|
|
|
<figcaption>{{ . }}{{ with $source.Params.credits }} ({{ . | $.Page.RenderString }}){{ end }}</figcaption>
|
2021-06-02 08:26:13 -07:00
|
|
|
{{- end }}
|
2021-02-20 12:39:31 -08:00
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|