Add base size to srcset in img and figure shortcodes.

This commit is contained in:
Fredrik Jonsson 2023-02-01 10:33:32 +01:00
commit 32a815789c
2 changed files with 6 additions and 0 deletions

View file

@ -41,6 +41,9 @@
{{ $src = $image.RelPermalink -}}
{{ $width = $image.Width -}}
{{ $height = $image.Height -}}
{{ if $srcset -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) }}
{{ end -}}
{{ else -}}
{{ $src = $resource.RelPermalink -}}
{{ $realwidth = $resource.Width -}}

View file

@ -37,6 +37,9 @@
{{ $src = $image.RelPermalink -}}
{{ $width = $image.Width -}}
{{ $height = $image.Height -}}
{{ if $srcset -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) }}
{{ end -}}
{{ else -}}
{{ $src = $resource.RelPermalink -}}
{{ $realwidth = $resource.Width -}}