{{- define "head" -}} {{ "" | safeHTML }} {{- $paginator := partial "partials/paginator.html" . }} {{- $enableSlide := not site.Params.home.disableSlide }} {{- $slides := where .Site.RegularPages "Type" "slide" }} {{- if and .IsHome (not $paginator.HasPrev) $enableSlide $slides }} {{- end }} {{- end -}} {{- define "aside" -}} {{- $paginator := partial "partials/paginator.html" . }} {{- $enableSlide := not site.Params.home.disableSlide }} {{- if and .IsHome (not $paginator.HasPrev) $enableSlide}} {{ partialCached "carousel.html" . }} {{- end }} {{- end -}} {{- define "top" -}} {{- $paginator := partial "partials/paginator.html" . }} {{- $enableListing := not site.Params.home.disableListing }} {{- if not $paginator.HasPrev }} {{- if .IsHome }} {{- if $enableListing}} {{- if and site.Taxonomies.series site.Taxonomies.categories }} {{- else }} {{ partial "listing.html" (dict "entry" "series") }} {{ partial "listing.html" (dict "entry" "categories") }} {{- end }} {{- end }} {{- with .Content }} {{ partial "hero.html" $ }} {{- end }} {{- else }} {{- if .IsSection }} {{- end }} {{- with .Content }} {{ partial "hero.html" $ }} {{- end }} {{- end }} {{- end }} {{- end -}} {{- define "main" -}} {{- $paginator := partial "partials/paginator.html" . }} {{- $firstPage := not $paginator.HasPrev }} {{- /* frequency for content view style */}} {{- $changeFreq := or .Params.Sitemap.ChangeFreq .Sitemap.ChangeFreq | lower }} {{- $active := eq $changeFreq (or "always" "hourly" "daily" "weekly") }} {{- $passive := ne $changeFreq (or "always" "hourly" "daily" "weekly") }} {{- /* main aside */}} {{- if and site.Taxonomies.tags $firstPage (ne .Kind "term") }} {{- if .IsHome }} {{- else if or (eq .Data.Singular "tag") .IsSection }} {{- end }} {{- end }} {{/* feed */}} {{- if ne .Kind "taxonomy" }} {{/* if page don't have article */}} {{- if eq (len $paginator.Pages) 0 }} {{ template "no-content"}} {{- else }}
{{- if .IsHome }} {{- if $firstPage }} {{ i18n "recent" $paginator.NumberOfElements }} {{- else }} {{ i18n "postsOn" $paginator.NumberOfElements }} {{ .Site.Title }} {{ printf "- %s %d" (i18n "pages" 1) $paginator.PageNumber }} {{- end }} {{- else }} {{- $title := .LinkTitle }} {{- if eq (lower $title) (lower (i18n "posts" 1)) }} {{- i18n "allPosts" }} {{- if not $firstPage }} {{- printf "- %s %d" (i18n "pages" 1) $paginator.PageNumber }} {{- end }} {{- else if eq (lower $title) (lower (i18n "articles" 1)) }} {{- i18n "articles" }} {{- else if eq .Data.Singular "author" }} {{- i18n "postsBy" }}: {{- $title }} {{- else }} {{- i18n "postsOn" }}: {{ $title }} {{- end }} {{- end }}
{{- /* list post */}} {{- $liViewCondition := or (and $active (not .IsHome)) (and (eq .Kind "term") (eq .Data.Plural "series") ) }} {{- if $liViewCondition }} {{ template "li" . }} {{- else }}
{{- range $index, $page := $paginator.Pages }} {{- $counter := add $index 1 }} {{- $author := default site.Params.Author.name .Params.author }} {{- $authors := .GetTerms "author" }} {{- $categories := .GetTerms "categories" }} {{- $desc := or .Params.Subtitle .Params.Description .Description .Summary }} {{- $hasCover := partial "partials/page/cover.html" (dict "page" .) }} {{- $alt := or .Params.Alt .Params.coverAlt .Params.imagesAlt }} {{- if $index }}{{- end }} {{ template "card" (dict "page" $page "paginator" $paginator "counter" $counter "desc" $desc "hasCover" $hasCover "alt" $alt "author" $author "authors" $authors) }} {{- end }}
{{/* paginator navigation */}} {{- if or .Paginator.HasPrev .Paginator.HasNext }}
{{- partial "nav.html" (dict "navID" "pagination" "page" .) }} {{- end }} {{- end }}
{{- end }} {{- else }} {{- if eq (index site.Taxonomies .Data.Plural | len) 0 }} {{ template "no-content"}} {{- else }} {{- /* taxonomy listing */}}
{{- if eq .Data.Singular "tag" }} {{ partial "listing.html" (dict "entry" "series") }} {{ partial "listing.html" (dict "entry" "categories") }} {{- else if eq .Data.Singular "category" }} {{ partial "listing.html" (dict "entry" "categories") }} {{- else if eq .Data.Singular "series" }} {{ partial "listing.html" (dict "entry" "series") }} {{- else if eq .Data.Singular "author" }} {{ partial "listing.html" (dict "entry" "author") }} {{- end }}
{{- end }} {{- end }} {{- end -}} {{- define "li" -}} {{- $descending := and (eq $.Kind "term") (eq $.Data.Plural "series")}} {{- $yearGroup := .Data.Pages.GroupByDate "2006" }} {{- if $descending }} {{- $yearGroup = $yearGroup.Reverse }} {{- end }} {{- range $yearGroup }} {{- $year := .Key }}
{{ $year }}
{{- $monthGroup := .Pages.GroupByDate "January" }} {{- if $descending }} {{ $monthGroup = $monthGroup.Reverse }} {{ end }} {{- range $monthGroup }} {{- $month := .Key }} {{- $postCounter := printf "(%d %s)" (len .Pages) (i18n "posts" (len .Pages)) }}
{{- $month }} {{- $pageGroup := .Pages }} {{- if $descending }} {{- $pageGroup = $pageGroup.Reverse }} {{- end }} {{- with $pageGroup }} {{- end }}
{{- end }}
{{- end }} {{- end -}} {{- define "card" -}}
{{- if .authors }} {{- if eq (len .authors) 1 }} {{- range .authors }} {{ .LinkTitle }} {{- end }} {{- else }} {{ partial "terms.html" (dict "taxonomy" "author" "class" "delimiter" "page" .page) }} {{- end }} {{- else }} {{- with .author }}{{ . }}{{ end }} {{- end }} {{- if .page.Params.categories }} {{ i18n "in" | lower }} {{- if eq (len .page.Params.categories) 1 }} {{ partial "terms.html" (dict "taxonomy" "categories" "class" "inline" "page" .page ) }} {{ else }} {{ partial "terms.html" (dict "taxonomy" "categories" "class" "delimiter" "page" .page ) }} {{- end }} {{- end }} {{ partial "page/timestamp.html" .page }}

{{ .page.Title }}

{{ $useFlowlines := site.Params.Feed.Flowlines }}
{{- if .hasCover }} {{ if .alt }}{{ . }}{{ else }}{{ i18n {{- else if $useFlowlines }} {{- $src := partial "partials/flowlines.html" . }} {{- $pseudoRandomPos := printf "object-position: %d%% %d%%" (index (seq 81 | shuffle) 11) (index (seq 80 | shuffle) 12) }} {{- end }}
{{- plainify .desc }}
{{- end -}} {{- define "no-content" -}}
Not today, maybe tomorow...

{{ i18n "noArticle" }}

{{ i18n "noArticlePost" }}

{{- end -}}