41 lines
1.6 KiB
HTML
41 lines
1.6 KiB
HTML
{{ with .Site.GetPage "person" }}
|
|
{{ with .GetPage ($.Get "name") }}
|
|
{{ $imageName := .Params.image }}
|
|
{{ $image := "" }}
|
|
{{ with .Resources.GetMatch $imageName}}
|
|
{{ $image = (.Fit "60x80 webp").RelPermalink }}
|
|
{{ else }}
|
|
{{ with .Resources.ByType "image" }}
|
|
{{ $image = ((index . 0).Fit "60x80 webp").RelPermalink }}
|
|
{{ warnf "Image for %s is not correclty found. Falling back to first found image in page resources." ($.Get "name") }}
|
|
{{ else }}
|
|
{{ with .Params.sex }}
|
|
{{ if eq . "male" }}
|
|
{{ $image = relURL "img/persons/male.png" }}
|
|
{{ else }}
|
|
{{ $image = relURL "img/persons/female.png" }}
|
|
{{ end }}
|
|
{{ warnf "Image for %s is not correclty found. Falling back to generic image." ($.Get "name") }}
|
|
{{ else }}
|
|
{{ warnf "Cannot find sex of %s." ($.Get "name") }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ $config :=
|
|
dict
|
|
"image" $image
|
|
"name" (.Params.title)
|
|
}}
|
|
{{ partial "tsc/start-person" $config }}
|
|
<div class="content content-trainer">
|
|
<div class="name">
|
|
{{- .Params.title -}}
|
|
</div>
|
|
</div>
|
|
{{ partial "tsc/end-person" . }}
|
|
{{ else }}
|
|
{{ warnf "Cannot find person %s." ($.Get "name") }}
|
|
<div class="person">{{ $.Get "name" }}</div>
|
|
{{ end }}
|
|
{{ end }}
|