{{ define "main" }} {{ .Scratch.Set "scope" "single" }}
{{ if .Params.showHero | default (site.Params.article.showHero | default false) }} {{ partial (printf "hero/%s.html" (.Params.heroStyle | default site.Params.article.heroStyle)) . }} {{ 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 }}
{{/* The Relative Wrapper: Acts as an anchor for the absolute TOC */}}
{{/* Sidebar TOC: Mobile flow (Top), Desktop absolute (Right) */}} {{ if .Params.showTableOfContents | default site.Params.article.showTableOfContents }} {{ end }} {{/* Main Content: Dead center, uninfluenced by anything */}}
{{ partial "series/series.html" . }} {{ .Content }} {{ if .Params.replyByEmail | default site.Params.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" . }}
{{ end }} {{ define "SingleAuthor" }}
{{ $authorsData := site.Data.authors }} {{ $baseURL := site.BaseURL }} {{ $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) }} {{ partial "author.html" . }} {{ end }} {{ range $author := .Page.Params.authors }} {{ $authorData := index $authorsData $author }} {{ if $authorData }} {{ $link := printf "%sauthors/%s/" $baseURL $author }} {{ partial "author-extra.html" (dict "context" . "data" $authorData "link" $link) }} {{ end }} {{ end }}
{{ end }}