2022-07-11 18:46:07 +00:00
|
|
|
{{- $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }}
|
|
|
|
{{- $customAlt := .Get "alt" }}
|
|
|
|
{{- $customSize := .Get "size" | lower }}
|
2022-07-17 18:37:19 +00:00
|
|
|
{{- $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.Get "lazy") }}
|
2021-02-20 20:39:31 +00:00
|
|
|
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- with $source }}
|
|
|
|
{{- $caption := default .Title $customAlt }}
|
2021-02-20 20:39:31 +00:00
|
|
|
|
2022-09-02 08:58:44 +00:00
|
|
|
{{- $origin := .Permalink }}
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- $profile := (.Fill "180x180 Center").Permalink }}
|
|
|
|
{{- $tiny := (.Resize "320x").Permalink }}
|
|
|
|
{{- $small := (.Resize "600x").Permalink }}
|
|
|
|
{{- $medium := (.Resize "1200x").Permalink }}
|
|
|
|
{{- $large := (.Resize "1800x").Permalink }}
|
2021-02-20 20:39:31 +00:00
|
|
|
|
2022-09-02 08:58:44 +00:00
|
|
|
{{- $size := dict "origin" $origin "profile" $profile "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">
|
2022-07-11 18:46:07 +00:00
|
|
|
<figure
|
2022-09-02 08:58:44 +00:00
|
|
|
class="gdoc-markdown__figure
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- if eq $customSize "profile" }}{{ print " gdoc-post__figure--round" }}{{ end }}"
|
|
|
|
>
|
2022-02-07 12:24:00 +00:00
|
|
|
<a class="gdoc-markdown__link--raw" href="{{ .Permalink }}">
|
2021-04-27 21:44:35 +00:00
|
|
|
<picture>
|
2022-01-06 12:58:10 +00:00
|
|
|
<source
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- with $customSize }}
|
2022-01-06 12:58:10 +00:00
|
|
|
srcset="{{ index $size $customSize }}"
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- else }}
|
2022-01-06 12:58:10 +00:00
|
|
|
srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
/>
|
|
|
|
<img
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- if $lazyLoad }}{{ print " loading=\"lazy\"" | safeHTMLAttr }}{{- end }}
|
2022-09-02 08:58:44 +00:00
|
|
|
{{- if eq $customSize "origin" }}
|
|
|
|
src="{{ $size.origin }}"
|
|
|
|
{{- else }}
|
|
|
|
src="{{ $size.large }}"
|
|
|
|
{{- end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
alt="{{ $caption }}"
|
|
|
|
/>
|
2021-04-27 21:44:35 +00:00
|
|
|
</picture>
|
2022-01-06 12:58:10 +00:00
|
|
|
</a>
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- if not (eq $customSize "profile") }}
|
|
|
|
{{- with $caption }}
|
|
|
|
<figcaption>
|
|
|
|
{{ . }}
|
|
|
|
{{- with $source.Params.credits }}
|
|
|
|
{{ printf " (%s)" . | $.Page.RenderString }}
|
|
|
|
{{- end }}
|
|
|
|
</figcaption>
|
|
|
|
{{- end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
{{- end }}
|
|
|
|
</figure>
|
|
|
|
</div>
|
2022-07-11 18:46:07 +00:00
|
|
|
{{- end }}
|