{{- $source := ($.Page.Resources.ByType "image").GetMatch (printf "%s" (.Get "name")) }} {{- $customAlt := .Get "alt" }} {{- $customSize := .Get "size" | lower }} {{- $lazyLoad := default (default true $.Site.Params.geekblogImageLazyLoading) (.Get "lazy") }} {{- $data := newScratch }} {{- with $source }} {{- $caption := default .Title $customAlt }} {{- $isSVG := (eq .MediaType.SubType "svg") }} {{- $origin := . }} {{- if $isSVG }} {{- $data.SetInMap "size" "tiny" "320" }} {{- $data.SetInMap "size" "small" "600" }} {{- $data.SetInMap "size" "medium" "1200" }} {{- $data.SetInMap "size" "large" "1800" }} {{- else }} {{- $data.SetInMap "size" "tiny" "320x"}} {{- $data.SetInMap "size" "small" "600x" }} {{- $data.SetInMap "size" "medium" "1200x" }} {{- $data.SetInMap "size" "large" "1800x" }} {{- end -}}