{{ .Page.Scratch.Add "hasImages" "true" }} {{/* Scratch to conditionally include js files. */}} {{/* Get the image */}} {{- $img := .Get "src" -}} {{- $width := .Get "width" -}} {{- $height := .Get "height" -}} {{- $isRemote := strings.HasPrefix $img "http" -}} {{- $isResized := false -}} {{- $isResponsive := false -}} {{- $originalImg := "" -}} {{- if not $isRemote -}} {{- $img = .Page.Resources.GetMatch $img -}} {{- if and (not $img) .Page.File -}} {{- $path := path.Join .Page.File.Dir $img -}} {{- $img = resources.Get $path -}} {{- end -}} {{- $originalImg = $img -}} {{/* Resize the image if desired */}} {{- if or $width $height }} {{- $isResized = true -}} {{- if and $width $height -}} {{- $img = ($img.Resize (print $width "x" $height)) -}} {{- else if $width -}} {{- $img = ($img.Resize (print $width "x")) -}} {{- else if $height -}} {{- $img = ($img.Resize (print "x" $height)) -}} {{- end -}} {{- end -}} {{- end -}} {{/* Generate responsive images if applicable */}} {{- $src_set := "" -}} {{- $placeholder := "" -}} {{- if not $isRemote -}} {{- if (ge $img.Width "500") -}} {{- $isResponsive = true -}} {{/* Very small placeholder, inline in HTML */}} {{- $placeholder = ($img.Resize "48x q20") | images.Filter (images.GaussianBlur 6) -}} {{- $src_set = (print $img.RelPermalink " " $img.Width "w") -}} {{- if ge $img.Width "500" -}} {{- $x_small := $img.Resize "500x" -}} {{- $src_set = (print $src_set ", " $x_small.RelPermalink " 500w") -}} {{- end -}} {{- if ge $img.Width "800" -}} {{- $small := $img.Resize "800x" -}} {{- $src_set = (print $src_set ", " $small.RelPermalink " 800w") -}} {{- end -}} {{- if ge $img.Width "1200" -}} {{- $medium := $img.Resize "1200x" -}} {{- $src_set = (print $src_set ", " $medium.RelPermalink " 1200w") -}} {{- end -}} {{- if gt $img.Width "1500" -}} {{- $large := $img.Resize "1500x" -}} {{- $src_set = (print $src_set ", " $large.RelPermalink " 1500w") -}} {{- end -}} {{- end -}} {{- end -}} {{ with .Get {{- if or (.Get "link") (or (.Get "attrlink") (or (.Get "attr") (or (.Get "title") (.Get "caption")))) -}}
{{- with (.Get "title") -}}

{{ . }}

{{- end -}} {{- with (.Get "caption") -}}

{{ . }}

{{- end -}} {{- if and (.Get "attr") (not (.Get "attrlink")) -}}

Source: {{ (.Get "attr") | markdownify }}

{{- end -}} {{- with (.Get "attrlink") -}}

Source: {{ default . (($.Get "attr") | markdownify) }}

{{- end -}} {{- if (.Get "link") -}} {{- $target := (.Get "linkTarget") | default "_blank" -}}

Link: {{ default . (($.Get "linkTxt") | markdownify) }}

{{- end -}}
{{- end -}}