{{ define "main" }} {{ if .Content }}
{{ .Content }}
{{ end }} {{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }} {{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }} {{ $PageContext := . }} {{ if .IsHome }} {{ $PageContext = .Site }} {{ end }} {{ if $.Site.Params.singlePageSite }}
{{ range .Site.Menus.main }}
{{ if eq (first 2 .URL) "/#" }}

{{ .Name }}

{{ $section := path.Join "homepage" .Identifier }} {{ with $.Site.GetPage $section }} {{ partial "section.html" . }} {{ end }}
{{ else }}

{{ .Name }}

{{ $thisSectionsPages := where $PageContext.RegularPages "Type" .Identifier }} {{ range first $.Site.Params.homepagePaginateCount $thisSectionsPages.ByDate.Reverse }} {{ partial "collection.html" . }} {{ end }} {{ end }}

{{ end }}
{{ else }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} {{ range $paginator.Pages.ByDate.Reverse }} {{ partial "collection.html" . }} {{ end }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}