{{/* Author profile box */}}

{{/* Don't show author box on normal pages or if author box disabled. */}}
{{ if ne .Type "page" | and (not (or (eq site.Params.profile false) (eq .Params.profile false))) }}

{{ $authors := .Params.authors }}

{{/* If authors not set, fallback to superuser/owner from Scratch */}}
{{ if (not $authors) }}
  {{ $superuser := .Scratch.Get "superuser_slug" }}
  {{ if $superuser }}
    {{ $authors = (slice $superuser) }}
  {{ end }}
{{ end }}

{{ if $authors }}
  {{ range $idx, $slug := $authors }}
    {{ $profile := partial "functions/get_author_profile" $slug }}
    {{ if $profile.has_data }}
      {{ partial "page_author_card" (dict "profile" $profile "page" .) }}
    {{ end }}
  {{ end }}
{{ end }}

{{end}}{{/* Show profile block */}}
