{{ define "main" }} <main> {{ $contentExists := gt (len .Content) 0 }} {{ $blogPages := where .Site.RegularPages.ByDate.Reverse ".Type" "in" .Site.Params.mainSections }} {{ $blogPages = where $blogPages ".Params.draft" "!=" true }} {{ $showLatest := and (default true site.Params.showBlogLatest) $blogPages }} {{ $headlessExists := false }} {{ if $contentExists }} {{ .Content }} {{ else }} {{ with .Site.GetPage "/homepage" }} {{ $headlessExists = true }} <div class="headless-homepage"> {{ range .Resources }} <h2> {{ .Title }} </h2> <p>{{ .Content }}</p> {{ end }} </div> {{ end }} {{ end }} {{ if and (or $headlessExists $contentExists) $showLatest }} <p class="delimiter">♦ ♦ ♦</p> {{ $blogLatest := default "Latest Blog Posts" site.Params.blogLatestHeading }} <h2 id="latest-blog-home">{{- $blogLatest -}}</h2> {{ end }} {{ if $showLatest }} {{ with $blogPages }} {{ range first (default 3 site.Params.nBlogLatest) . }} {{- partial "blog-entry-summary" . -}} {{ end }} {{ end }} {{ end }} </main> {{ end }}