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")) -}}
|
2023-09-08 17:59:34 +00:00
|
|
|
{{ $light_jpg := resources.GetMatch (printf "/p/%s.jpg" (.Get "name")) -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $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")) -}}
|
2023-09-08 17:59:34 +00:00
|
|
|
{{ $dark_jpg := resources.GetMatch (printf "/p/%s_dark.jpg" (.Get "name")) -}}
|
2021-01-28 21:08:21 +00:00
|
|
|
{{ $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
|
|
|
|
2023-09-08 17:59:34 +00:00
|
|
|
{{- $orig_img := $light_png -}}
|
|
|
|
{{- $orig_img_type := "image/png" -}}
|
|
|
|
{{- $orig_img_dark := $dark_png -}}
|
|
|
|
{{- $orig_img_dark_type := "image/png" -}}
|
|
|
|
{{- with $light_jpg -}}
|
|
|
|
{{- $orig_img_type = "image/jpeg" -}}
|
|
|
|
{{- $orig_img = $light_jpg -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $dark_jpg -}}
|
|
|
|
{{- $orig_img_dark_type = "image/jpeg" -}}
|
|
|
|
{{- $orig_img_dark = $dark_jpg -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- $img_width := $orig_img.Width -}}
|
|
|
|
{{- $img_height := $orig_img.Height -}}
|
2022-04-09 15:54:58 +00:00
|
|
|
{{- 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-09 15:54:58 +00:00
|
|
|
{{- end -}}
|
2022-05-09 15:25:13 +00:00
|
|
|
<picture>
|
2022-09-24 05:37:15 +00:00
|
|
|
{{- if not (in site.BaseURL ".onion") -}}
|
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-05-30 22:49:31 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)" />
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ end -}}
|
2022-09-24 05:37:15 +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-05-30 22:49:31 +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-05-30 22:49:31 +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-05-30 22:49:31 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)" />
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ end -}}
|
2023-09-08 17:59:34 +00:00
|
|
|
{{ with $orig_img_dark -}}
|
|
|
|
{{ $orig_dark_src := . | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2023-09-08 17:59:34 +00:00
|
|
|
srcset="{{ $orig_dark_src.RelPermalink }}"
|
|
|
|
type="{{ $orig_img_dark_type }}"
|
2022-05-30 22:49:31 +00:00
|
|
|
media="screen and (prefers-color-scheme: dark)" />
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ end -}}
|
2022-09-24 05:37:15 +00:00
|
|
|
{{- if not (in site.BaseURL ".onion") -}}
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ with $light_svg -}}
|
|
|
|
{{ $light_svg_src := . | resources.Fingerprint "md5" -}}
|
|
|
|
<source
|
|
|
|
srcset="{{ $light_svg_src.RelPermalink }}"
|
2022-05-30 22:49:31 +00:00
|
|
|
type="image/svg+xml" />
|
2021-02-02 06:24:40 +00:00
|
|
|
{{ end -}}
|
2022-09-24 05:37:15 +00:00
|
|
|
{{ end -}}
|
2021-06-28 02:25:58 +00:00
|
|
|
{{ with $light_jxl -}}
|
|
|
|
{{ $light_jxl_src := . | resources.Fingerprint "md5" -}}
|
|
|
|
<source
|
|
|
|
srcset="{{ $light_jxl_src.RelPermalink }}"
|
2022-05-30 22:49:31 +00:00
|
|
|
type="image/jxl" />
|
2021-06-28 02:25:58 +00:00
|
|
|
{{ 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 }}"
|
2022-05-30 22:49:31 +00:00
|
|
|
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 }}"
|
2022-05-30 22:49:31 +00:00
|
|
|
type="image/webp" />
|
2021-01-27 21:47:46 +00:00
|
|
|
{{ end -}}
|
2023-09-08 17:59:34 +00:00
|
|
|
{{ $orig_src := $orig_img | resources.Fingerprint "md5" -}}
|
2021-01-27 21:47:46 +00:00
|
|
|
<source
|
2023-09-08 17:59:34 +00:00
|
|
|
srcset="{{ $orig_src.RelPermalink }}"
|
|
|
|
type="{{ $orig_img_type }}" />
|
2022-05-09 15:25:13 +00:00
|
|
|
<img{{ with .Get "class" }} class="{{ . }}"{{ end }}
|
2022-04-09 15:54:58 +00:00
|
|
|
width="{{ $img_width }}" height="{{ $img_height }}"
|
2023-09-08 17:59:34 +00:00
|
|
|
src="{{ $orig_src.Permalink }}" 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") -}}
|
2023-11-27 08:24:30 +00:00
|
|
|
itemprop="image contentUrl url"
|
2022-05-06 17:30:11 +00:00
|
|
|
{{ end -}}
|
|
|
|
{{- end -}}
|
2022-05-30 22:49:31 +00:00
|
|
|
decoding="async" />
|
2022-02-19 20:47:07 +00:00
|
|
|
</picture>{{- /* Strip trailing newline: https://github.com/gohugoio/hugo/issues/1753 */ -}}
|