2021-04-27 21:44:35 +00:00
|
|
|
{{ $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }}
|
2021-02-20 20:39:31 +00:00
|
|
|
{{ $customAlt := .Get "alt" }}
|
|
|
|
{{ $customSize := .Get "size" }}
|
|
|
|
{{ $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.Get "lazy") }}
|
|
|
|
|
|
|
|
{{ with $source }}
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $caption := default .Title $customAlt }}
|
2021-02-20 20:39:31 +00:00
|
|
|
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $tiny := (.Resize "320x").RelPermalink }}
|
|
|
|
{{ $small := (.Resize "600x").RelPermalink }}
|
|
|
|
{{ $medium := (.Resize "1200x").RelPermalink }}
|
|
|
|
{{ $large := (.Resize "1800x").RelPermalink }}
|
2021-02-20 20:39:31 +00:00
|
|
|
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }}
|
2021-02-20 20:39:31 +00:00
|
|
|
|
2022-01-06 12:58:10 +00:00
|
|
|
|
|
|
|
<div class="flex justify-center">
|
|
|
|
<figure class="gdoc-markdown__figure">
|
|
|
|
<a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
|
2021-04-27 21:44:35 +00:00
|
|
|
<picture>
|
2022-01-06 12:58:10 +00: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 21:44:35 +00:00
|
|
|
</picture>
|
2022-01-06 12:58:10 +00:00
|
|
|
</a>
|
|
|
|
{{ with $caption -}}
|
|
|
|
<figcaption>
|
|
|
|
{{ . }}{{ with $source.Params.credits }}({{ . | $.Page.RenderString }}){{ end }}
|
|
|
|
</figcaption>
|
|
|
|
{{- end }}
|
|
|
|
</figure>
|
|
|
|
</div>
|
2021-02-20 20:39:31 +00:00
|
|
|
{{ end }}
|