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-06-28 02:25:58 +00:00
|
|
|
{{ $light_jxl := resources.GetMatch (printf "/p/%s.jxl" (.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-06-28 02:25:58 +00:00
|
|
|
{{ $dark_jxl := resources.GetMatch (printf "/p/%s_dark.jxl" (.Get "name")) -}}
|
2022-04-09 15:54:58 +00:00
|
|
|
|
2022-04-27 05:39:12 +00:00
|
|
|
{{- $isPix := false -}}
|
2022-04-09 15:54:58 +00:00
|
|
|
{{- $img_width := $light_png.Width -}}
|
|
|
|
{{- $img_height := $light_png.Height -}}
|
|
|
|
{{- with (.Get "sf") -}}
|
2022-04-28 00:20:16 +00:00
|
|
|
{{- $img_width = (mul $img_width . | math.Round) -}}
|
|
|
|
{{- $img_height = (mul $img_height . | math.Round ) -}}
|
2022-04-27 05:39:12 +00:00
|
|
|
{{- if eq . 2 -}}
|
|
|
|
{{- $isPix = true -}}
|
|
|
|
{{- end -}}
|
2022-04-09 15:54:58 +00:00
|
|
|
{{- end -}}
|
2022-04-27 05:39:12 +00:00
|
|
|
<picture{{ if $isPix }} class="pix"{{ end }}>
|
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"
|
2022-03-18 06:30:46 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)">
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ end -}}
|
2021-06-28 02:25:58 +00:00
|
|
|
{{ with $dark_jxl -}}
|
|
|
|
{{ $dark_jxl_src := . | resources.Fingerprint "md5" -}}
|
|
|
|
<source
|
|
|
|
srcset="{{ $dark_jxl_src.RelPermalink }}"
|
|
|
|
type="image/jxl"
|
2022-03-18 06:30:46 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)">
|
2021-06-28 02:25:58 +00:00
|
|
|
{{ 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"
|
2022-03-18 06:30:46 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)">
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ 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"
|
2022-03-18 06:30:46 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)">
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ 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"
|
2022-03-18 06:30:46 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)">
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ 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-06-28 02:25:58 +00:00
|
|
|
{{ with $light_jxl -}}
|
|
|
|
{{ $light_jxl_src := . | resources.Fingerprint "md5" -}}
|
|
|
|
<source
|
|
|
|
srcset="{{ $light_jxl_src.RelPermalink }}"
|
|
|
|
type="image/jxl">
|
|
|
|
{{ 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
|
2022-04-09 15:54:58 +00:00
|
|
|
width="{{ $img_width }}" height="{{ $img_height }}"
|
2022-04-04 03:53:13 +00:00
|
|
|
src="{{ $light_png.RelPermalink }}" alt='{{ .Get "alt" }}'
|
2022-04-27 05:39:12 +00:00
|
|
|
{{ with .Parent -}}
|
2022-05-06 17:30:11 +00:00
|
|
|
{{ if eq .Name "transcribed-image-figure" -}}
|
|
|
|
{{ with .Get "id" -}}
|
2022-04-27 05:39:12 +00:00
|
|
|
aria-describedby="transcript-{{ . }}"
|
2022-05-06 17:30:11 +00:00
|
|
|
{{ end -}}
|
|
|
|
{{ end -}}
|
|
|
|
{{ if or (eq .Name "image-figure") (eq .Name "transcribed-image-figure") -}}
|
|
|
|
itemprop="contentURL url"
|
|
|
|
{{ end -}}
|
|
|
|
{{- end -}}
|
2021-06-28 02:25:58 +00:00
|
|
|
decoding="async">
|
2022-02-19 20:47:07 +00:00
|
|
|
</picture>{{- /* Strip trailing newline: https://github.com/gohugoio/hugo/issues/1753 */ -}}
|