{{ define "main" }}
{{ if and (isset .Site.Params "episode_number_style") (.Params.episode) }} {{ if eq .Site.Params.episode_number_style "parens" }}

{{ title .Title }} ({{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }})

{{ else if eq .Site.Params.episode_number_style "brackets" }}

{{ title .Title }} [{{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}]

{{ else if eq .Site.Params.episode_number_style "dash" }}

{{ title .Title }} - {{ with .Site.Params.episode_number_prefix }}{{ . }}{{ end }}{{ .Params.episode }}

{{ else }}

{{ title .Title }}

{{ end }} {{ else }}

{{ title .Title }}

{{ end }} {{- if ne $.Params.upcoming true -}} Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "episode-metadata.html" .}} {{- else -}} Scheduled for {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "episode-metadata.html" .}} {{- end -}}
{{ if isset .Params "episode_banner" }} {{ if ne .Params.episode_banner "" }}
{{ .Description | markdownify }}
{{ end }} {{ else }} {{- if isset .Params "episode_image" -}} {{- if ne .Params.episode_image "" -}}
{{ .Description | markdownify }}
{{- end -}} {{- else -}}
{{ .Description | markdownify }}
{{- end -}} {{ end }} {{- with .Params.podcast_file -}} {{- if ne $.Params.upcoming true -}}
{{- end -}} {{- end -}} {{- with .Params.youtube -}} {{- if ne $.Params.upcoming true -}}
{{- end -}} {{- end -}} {{- with .Params.transcript -}}

Transcript

{{ (readFile .) | markdownify}}
{{- end -}}

Show Notes

{{ .Content }}
{{ with .Params.guests }}

Guests

{{ range $name := . }} {{ $.Scratch.Set "person" $name }} {{- range where $.Site.Pages "Type" "guest" -}} {{- if eq .File.BaseFileName ($.Scratch.Get "person") -}} {{- $.Scratch.Set "guest-exist" "true" -}}
{{- if and (isset .Params "thumbnail") (ne .Params.thumbnail "") -}} {{- if (eq (slicestr .Params.thumbnail 0 4) "http") -}} {{ .Title }} {{- else -}} {{ .Title }} {{- end -}} {{- else -}} {{ .Title }} {{- end -}}

{{ .Title }} {{ with .Params.Pronouns }}({{ . }}){{ end }}

{{ .Content }} {{- with .Params.Website -}} {{- end -}} {{- with .Params.Twitter -}} {{- end -}} {{- with .Params.GitHub -}} {{- end -}} {{- with .Params.LinkedIn -}} {{- end -}} {{- with .Params.Facebook -}} {{- end -}} {{- with .Params.Pinterest -}} {{- end -}} {{- with .Params.Instagram -}} {{- end -}} {{- with .Params.YouTube -}} {{- end -}} {{- with .Params.Twitch -}} {{- end -}}
{{- $.Scratch.Set "guest-exist" "false" -}} {{- end -}} {{- end -}} {{- if ne ($.Scratch.Get "guest-exist") "true" -}} {{- if (isset $.Site.Data.guests ($.Scratch.Get "person")) -}} {{- $p := (index $.Site.Data.guests ($.Scratch.Get "person")) -}}
{{- if and (isset $p "thumbnail") (ne $p.thumbnail "") -}} {{- if (eq (slicestr $p.thumbnail 0 4) "http") -}} {{ $p.full_name }} {{- else -}} {{ $p.full_name }} {{- end -}} {{- else -}} {{ $p.full_name }} {{- end -}}

{{ $p.full_name }}

{{- if isset $p "bio" -}}

{{ $p.bio | markdownify }}

{{ end }} {{ if isset $p "homepage" }} {{ end }} {{ if isset $p "twitter" }} {{ end }} {{ if isset $p "github"}} {{ end }} {{ if isset $p "linkedin" }} {{ end }} {{ if isset $p "facebook" }} {{ end }}
{{ end }} {{ end }} {{ end }} {{ end }} {{ with .Params.hosts }}

Hosts

{{ range $name := . }} {{ $.Scratch.Set "person" $name }} {{- range where $.Site.Pages "Type" "host" -}} {{- if eq .File.BaseFileName ($.Scratch.Get "person") -}} {{- $.Scratch.Set "host-exist" "true" -}}
{{- if and (isset .Params "thumbnail") (ne .Params.thumbnail "") -}} {{- if (eq (slicestr .Params.thumbnail 0 4) "http") -}} {{ .Title }} {{- else -}} {{ .Title }} {{- end -}} {{- else -}} {{ .Title }} {{- end -}}

{{ .Title }} {{ with .Params.Pronouns }}({{ . }}){{ end }}

{{ .Content }} {{- with .Params.Website -}} {{- end -}} {{- with .Params.Twitter -}} {{- end -}} {{- with .Params.GitHub -}} {{- end -}} {{- with .Params.LinkedIn -}} {{- end -}} {{- with .Params.Facebook -}} {{- end -}} {{- with .Params.Pinterest -}} {{- end -}} {{- with .Params.Instagram -}} {{- end -}} {{- with .Params.YouTube -}} {{- end -}} {{- with .Params.Twitch -}} {{- end -}}
{{- $.Scratch.Set "host-exist" "false" -}} {{- end -}} {{- end -}} {{ end }} {{ end }} {{- with .Params.sponsors -}}
{{- end -}} {{ range $sponsor :=.Params.sponsors }} {{ if isset $.Site.Data.sponsors $sponsor }} {{ $s := (index $.Site.Data.sponsors $sponsor) }}
{{ $sponsor }}

{{end}} {{end}} {{- with .Params.sponsors -}}
{{- end -}}
{{ with .Site.Params.disqusShortname }}
{{ partial "disqus.html" }}
{{ end }} {{ with .Site.Params.giscus }}
{{ partial "giscus.html" }}
{{ end }}
{{ end }}