2021-01-28 21:08:21 +00:00
|
|
|
{{ $light_png := resources.GetMatch (printf "/p/%s.png" (.Get "name")) -}}
|
|
|
|
{{ $light_webp := resources.GetMatch (printf "/p/%s.webp" (.Get "name")) -}}
|
|
|
|
{{ $light_avif := resources.GetMatch (printf "/p/%s.avif" (.Get "name")) -}}
|
|
|
|
{{ $dark_png := resources.GetMatch (printf "/p/%s_dark.png" (.Get "name")) -}}
|
|
|
|
{{ $dark_webp := resources.GetMatch (printf "/p/%s_dark.webp" (.Get "name")) -}}
|
|
|
|
{{ $dark_avif := resources.GetMatch (printf "/p/%s_dark.avif" (.Get "name")) -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<picture>
|
|
|
|
{{ with $dark_avif -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $dark_avif_src := . | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2021-01-28 21:08:21 +00:00
|
|
|
srcset="{{ $dark_avif_src.RelPermalink }}"
|
2021-01-27 21:47:46 +00:00
|
|
|
type="image/avif"
|
|
|
|
media="(prefers-color-scheme: dark)">
|
|
|
|
{{ end -}}
|
|
|
|
{{ with $dark_webp -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $dark_webp_src := . | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2021-01-28 21:08:21 +00:00
|
|
|
srcset="{{ $dark_webp_src.RelPermalink }}"
|
2021-01-27 21:47:46 +00:00
|
|
|
type="image/webp"
|
|
|
|
media="(prefers-color-scheme: dark)">
|
|
|
|
{{ end -}}
|
|
|
|
{{ with $dark_png -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $dark_png_src := . | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2021-01-28 21:08:21 +00:00
|
|
|
srcset="{{ $dark_png_src.RelPermalink }}"
|
2021-01-27 21:47:46 +00:00
|
|
|
type="image/png"
|
|
|
|
media="(prefers-color-scheme: dark)">
|
|
|
|
{{ end -}}
|
|
|
|
{{ with $light_avif -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $light_avif_src := . | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2021-01-28 21:08:21 +00:00
|
|
|
srcset="{{ $light_avif_src.RelPermalink }}"
|
|
|
|
type="image/avif">
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ end -}}
|
|
|
|
{{ with $light_webp -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $light_webp_src := . | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2021-01-28 21:08:21 +00:00
|
|
|
srcset="{{ $light_webp_src.RelPermalink }}"
|
|
|
|
type="image/webp">
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ end -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $light_png_src := $light_png | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2021-01-28 21:08:21 +00:00
|
|
|
srcset="{{ $light_png_src.RelPermalink }}"
|
|
|
|
type="image/png">
|
2021-01-27 21:47:46 +00:00
|
|
|
<img
|
|
|
|
width="{{ $light_png.Width }}"
|
|
|
|
src="{{ $light_png.RelPermalink }}" alt='{{ .Get "alt" }}'>
|
|
|
|
</picture>
|