{{ $dateFormat := default "Mon Jan 2, 2006" (index .Site.Params "date_format") }} {{/* get three random posts: 1 for large feature, 2 for small features */}} {{ range $index, $element := first 3 (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) | shuffle }} {{ if eq $index 0 }}

{{ .Title }}

{{ substr .Description 0 110 }}

Continue reading...

{{ end }} {{ if eq $index 1 }}
{{ end }} {{ if or (eq $index 1) (eq $index 2) }}
World

{{ .Title }}

{{ if not .PublishDate.IsZero }}{{ end }}

{{ substr .Description 0 110 }}

Continue reading
{{ range first 1 (.Resources.ByType "image") }} {{/* 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 */}} {{ $RotatedImage := $image.Resize "480x600 r90" }} {{ else }} {{ end }} {{ end }} {{ end }}
{{ end }} {{ end }}
{{- /* vim: set ts=2 sw=2 et: */}}