{{ 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 not (in $.Site.Params.homepageNavEntriesDontRender .Identifier) }}
{{ $navLinkPage := $.Site.GetPage .URL }} {{ if eq (first 2 .URL) "/#" }}

{{ .Name }}

{{ $section := path.Join "homepage" .Identifier }} {{ with $.Site.GetPage $section }} {{ partial "section.html" . }} {{ end }}
{{ else if in "section term" $navLinkPage.Kind }}

{{ .Name }}

{{ $paginateCount := default 2 $.Site.Params.homepagePaginateCount }} {{ range first $paginateCount $navLinkPage.Pages }} {{ partial "collection.html" . }} {{ end }} {{ else if eq $navLinkPage.Kind "page" }} {{ partial "section.html" $navLinkPage }} {{ else if eq $navLinkPage.Kind "taxonomy" }}

{{ .Name }}

    {{ range $key, $value := $navLinkPage.Data.Terms.Alphabetical }} {{ $name := .Name }} {{ $count := .Count }} {{ with $.Site.GetPage (printf "/%s/%s" "tags" $name) }}
  • {{ .Name }} ({{ $count }})
  • {{ end }} {{ end }}
{{ else if eq $navLinkPage.Kind "taxonomy" }}

{{ .Name }}

{{ else }} {{ $navLinkPage.Kind }} is not supported yet. {{ end }}

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