<divclass="mb-1 text-muted">{{ if not .PublishDate.IsZero }}<time{{.Date.Format"2006-01-02T15:04:05Z07:00"|printf"datetime=%q"|safeHTMLAttr}}>{{ .Date.Format $dateFormat }}</time>{{ end }}</div>
{{/* get a local variable for the image because we will change context below */}}
{{ $image := . }}
{{/* set orientation to 1 just in case it doesnt exist in Exif */}}
{{ $orientation := 1 }}
{{ with .Exif }}
{{ $orientation = .Tags.Orientation }}
{{ if eq $orientation 8 }}
{{/* Rotate image before cropping because Hugo's "Smart" cropping crops differently if we do it at the same time as .Fill with a rotation) and use 2x dimensions to keep the thumbnail crisp */}}