{{- define "main" -}} {{- $slug := .File.Dir | strings.TrimSuffix "/" | path.Base -}} {{- $posts := where .Site.RegularPages "Params.author" $slug -}}
{{- $avatarRes := .Resources.GetMatch "avatar.*" -}} {{- $avatarSrc := "" -}} {{- with $avatarRes }}{{ $avatarSrc = .RelPermalink }}{{ else }}{{ with $.Params.avatar }}{{ $avatarSrc = . }}{{ end }}{{ end -}} {{- if $avatarSrc -}}
{{ .Params.name | default .Title }}
{{- else -}}
{{ substr (.Params.name | default .Title) 0 1 }}
{{- end -}}
Artist

{{ .Params.name | default .Title }}

{{- with .Params.bio -}}

{{ . }}

{{- end -}} {{- with .Params.social -}} {{- $bases := dict "instagram" "https://instagram.com/" "x" "https://x.com/" "twitter" "https://x.com/" "github" "https://github.com/" "behance" "https://www.behance.net/" "artstation" "https://www.artstation.com/" -}}
{{- range $platform, $handle := . -}} {{- $href := cond (hasPrefix $handle "http") $handle (printf "%s%s" (index $bases $platform | default "#") $handle) -}} {{ $platform | upper }} {{ partial "icon.html" "arrow-external" }} {{- end -}}
{{- end -}} {{- if $posts -}}

{{ len $posts }} {{ if eq (len $posts) 1 }}editorial{{ else }}editorials{{ end }}

{{- end -}}
{{- with .Content -}}
{{ . }}
{{- end -}} {{- if $posts -}}

Works by {{ .Params.name | default .Title }}

{{- range $posts.ByDate.Reverse -}} {{- partial "post-card.html" . -}} {{- end -}}
{{- else -}}

No editorials published yet.

{{- end -}} {{- end -}}