2021-02-02 06:24:40 +00:00
|
|
|
{{ $light_svg := resources.GetMatch (printf "/p/%s.svg" (.Get "name")) -}}
|
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")) -}}
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ $dark_svg := resources.GetMatch (printf "/p/%s_dark.svg" (.Get "name")) -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $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>
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ with $dark_svg -}}
|
|
|
|
{{ $dark_svg_src := . | resources.Fingerprint "md5" -}}
|
|
|
|
<source
|
|
|
|
srcset="{{ $dark_svg_src.RelPermalink }}"
|
|
|
|
type="image/svg+xml"
|
|
|
|
media="(prefers-color-scheme: dark)">
|
|
|
|
{{ end -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ 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 -}}
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ with $light_svg -}}
|
|
|
|
{{ $light_svg_src := . | resources.Fingerprint "md5" -}}
|
|
|
|
<source
|
|
|
|
srcset="{{ $light_svg_src.RelPermalink }}"
|
|
|
|
type="image/svg+xml">
|
|
|
|
{{ end -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ 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
|
2021-03-02 05:26:57 +00:00
|
|
|
width="{{ $light_png.Width }}" height="{{ $light_png.Height }}"
|
2021-01-27 21:47:46 +00:00
|
|
|
src="{{ $light_png.RelPermalink }}" alt='{{ .Get "alt" }}'>
|
|
|
|
</picture>
|