{{ define "main" }} {{ .Scratch.Set "scope" "single" }}
{{/* Hero */}} {{ if .Params.showHero | default (site.Params.article.showHero | default false) }} {{ $heroStyle := .Params.heroStyle }} {{ if not $heroStyle }}{{ $heroStyle = site.Params.article.heroStyle }}{{ end }} {{ $heroStyle := print "hero/" $heroStyle ".html" }} {{ if templates.Exists ( printf "partials/%s" $heroStyle ) }} {{ partial $heroStyle . }} {{ else }} {{ partial "hero/basic.html" . }} {{ end }} {{ end }} {{/* Header */}}
{{ if .Params.showBreadcrumbs | default (site.Params.article.showBreadcrumbs | default false) }} {{ partial "breadcrumbs.html" . }} {{ end }}

{{ .Title | emojify }}

{{ partial "article-meta/basic.html" (dict "context" . "scope" "single") }}
{{ if not (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} {{ template "SingleAuthor" . }} {{ end }}
{{/* Body */}}
{{ $enableToc := site.Params.article.showTableOfContents | default false }} {{ $enableToc = .Params.showTableOfContents | default $enableToc }} {{ $showToc := and $enableToc (in .TableOfContents "
{{ if $showToc }} {{ partial "toc.html" . }} {{ end }} {{ if $showRelated }} sd {{ end }}
{{ end }}
{{ partial "series/series.html" . }}
{{ .Content }} {{ $defaultReplyByEmail := site.Params.replyByEmail }} {{ $replyByEmail := default $defaultReplyByEmail .Params.replyByEmail }} {{ if $replyByEmail }} Reply by Email {{ end }}
{{ if (.Params.showAuthorBottom | default (site.Params.article.showAuthorBottom | default false)) }} {{ template "SingleAuthor" . }} {{ end }} {{ partial "series/series-closed.html" . }} {{ partial "sharing-links.html" . }} {{ partial "related.html" . }}
{{ $translations := .AllTranslations }} {{ with .File }} {{ $path := .Path }} {{ range $translations }} {{ $lang := print "." .Lang ".md" }} {{ $path = replace $path $lang ".md" }} {{ end }} {{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint (site.Params.fingerprintAlgorithm | default "sha512") }} {{ end }}
{{/* Footer */}}
{{ end }} {{ define "SingleAuthor" }} {{ $authorsData := site.Data.authors }} {{ $taxonomies := site.Taxonomies.authors }} {{ $baseURL := site.BaseURL }} {{ $taxonomyLink := 0 }} {{ $showAuthor := 0 }} {{ $isAuthorBottom := (.Params.showAuthorBottom | default ( site.Params.article.showAuthorBottom | default false)) }} {{ if not (strings.HasSuffix $baseURL "/") }} {{ $baseURL = delimit (slice $baseURL "/") "" }} {{ end }} {{ if .Params.showAuthor | default (site.Params.article.showAuthor | default true) }} {{ $showAuthor = 1 }} {{ partial "author.html" . }} {{ end }} {{ range $author := .Page.Params.authors }} {{ $authorData := index $authorsData $author }} {{- if $authorData -}} {{ range $taxonomyname, $taxonomy := $taxonomies }} {{ if (eq $taxonomyname $author) }} {{ $taxonomyLink = delimit (slice $baseURL "authors/" $author "/") "" }} {{ end }} {{ end }} {{ $finalLink := $taxonomyLink }} {{ $currentLang := site.Language.Lang }} {{ if eq site.LanguagePrefix "" }} {{ $finalLink = printf "%sauthors/%s/" $baseURL $author }} {{ else }} {{ $finalLink = printf "%s%s/authors/%s/" $baseURL $currentLang $author }} {{ end }} {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $finalLink) }} {{- end -}} {{ end }} {{ if or $taxonomyLink $showAuthor }}
{{ end }} {{ end }}