{{ $original := .Page.Resources.GetMatch (.Get "src") }} {{ $options := default "1000x" (.Get "options") }} {{ .Scratch.Set "image" $original }} {{ $command := (default "Resize" (.Get "command")) }} {{ if eq $command "Fit"}} {{ .Scratch.Set "image" ($original.Fit $options) }} {{ else if eq $command "Resize"}} {{ .Scratch.Set "image" ($original.Resize $options) }} {{ else if eq $command "Fill"}} {{ .Scratch.Set "image" ($original.Fill $options) }} {{ end }} {{ define "img" }} {{ $image := .Scratch.Get "image" }} <img src='{{ $image.RelPermalink }}' class='{{ .Get "class" }}' alt="{{ .Inner | plainify }}" style="max-width: 60%;" /> {{ end }} {{ if .Inner }} <figure class="text-center"> {{ template "img" . }} <figcaption class="text-center"> <small>{{ .Inner }}</small> </figcaption> </figure> {{ else }} {{ template "img" . }} {{ end }}