{{- $old_filename := .Get "src" -}} {{- $img := (.Page.Resources.ByType "image").GetMatch (path.Join "images" $old_filename ) -}} {{- if $img -}} {{- $thumb := $img.Fit "800x800 q90 webp" -}} {{- $new_filename := replace $old_filename (path.Ext $old_filename) "" -}} {{- $dithered := printf "images/dithers/%s_dithered.png" $new_filename -}} {{ $dithered_image := (.Page.Resources.ByType "image").GetMatch $dithered }} {{- $optBlock := dict "display" "block" -}} {{- $alt := .Inner -}}
{{ with $alt }}{{ $alt | markdownify| plainify }}{{ else }}{{ .Get "alt" }}{{ . | markdownify| plainify }}{{ end }}
{{ .Inner }}
{{ i18n "vieworig" | default "View original image"}} {{ i18n "viewdither" | default "View dithered image"}}
{{- else -}} {{ $new_filename := replace $old_filename (path.Ext $old_filename) ""}} {{ $dithered := printf "images/dithers/%s_dithered.png" $new_filename }} {{ $dithered_image := (.Page.Resources.ByType "image").GetMatch $dithered }} {{- $alt := .Inner -}}
{{ with $alt }}{{ $alt | markdownify| plainify }}{{ else }}{{ .Get "alt" }}{{ . | markdownify| plainify }}{{ end }}
{{ .Inner }}
{{ i18n "vieworig" | default "View original image"}} {{ i18n "viewdither" | default "View dithered image"}}
{{end}}