{{ define "global" }} {{ .Scratch.Set "CSSModules" (slice "list" "page") }} {{ .Scratch.Set "CSSModulesCritical" (slice) }} {{ $image := "" }} {{ $mainPages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := first 5 $mainPages }} {{ if and (len $pages) (.Params.FeatureFirstArticle) }} {{ with index $pages 0 }} {{ $image = partial "helper/image" (dict "Resources" .Resources "Image" .Params.Image) }} {{ end }} {{ else }} {{ $image = partial "helper/image" (dict "Resources" .Resources "Image" .Params.Image) }} {{ end }} {{ .Scratch.Set "hasBlurryHero" (and $image (default .Site.Params.Default.Hero.Blurry .Params.Hero.Blurry)) }} {{ .Scratch.Set "image" $image }} {{ end }} {{ define "main" }} {{ $mainPages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := first 5 $mainPages }} {{ $ShowImage := false }} {{ with ($.Scratch.Get "image") }}{{ $ShowImage = true }}{{ end }} {{ $heroParams := (dict "Context" . "Image" ($.Scratch.Get "image") "Title" (default .Site.Title .Title) "Description" (default .Site.Params.Description .Params.Description) "ShowImage" $ShowImage "ImageWidths" $.Site.Params.Page.Image.Widths ) }} {{ $SinglePage := .Params.SinglePage }} {{ $FeatureFirstArticle := and (and (len $pages) (.Params.FeatureFirstArticle)) (not $SinglePage) }} {{ if $FeatureFirstArticle }} {{- $latest := index $pages 0 -}} {{ $heroParams = merge $heroParams (dict "SmallTitle" "Latest Post" "Title" (printf `%s` $latest.RelPermalink $latest.Title) "Description" $latest.Params.Description ) }} {{ end }} {{ partial "common/hero" $heroParams }} {{ if $SinglePage }} {{ partial "page/main" . }} {{ else }} {{ if $FeatureFirstArticle }} {{- $latest := index $pages 0 -}} {{- with $latest -}}
{{ if .Truncated }}
{{ .Summary }}
{{ T "continue_reading" }}
{{ end }}
{{ end }} {{ end }}
{{ if and (not $FeatureFirstArticle) (len $pages) }}
{{ partial "list/default" (index $pages 0) }}
{{ end }} {{ if gt (len $pages) 1 }}

{{ range $index, $val := (after 1 $pages) }} {{ partial "list/compact" (dict "Context" $val) }} {{ end }}
{{ end }} {{ if gt (len $mainPages) 5 }} {{- $query := first 1 (where .Site.Pages "Layout" "==" "archives") -}} {{ if $query }} {{ T "more_posts" }} {{ end }} {{ end }}
{{ end }} {{ end }}