Files
2013roadtripukie/themes/hugo-theme-notrack/layouts/home.html
2022-09-04 14:08:48 +02:00

42 lines
1.4 KiB
HTML

{{ 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">&diams; &diams; &diams;</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 }}