2023-11-25 19:53:14 +00:00
{{/* Hugo Blox: Biography */}}
2023-11-07 23:09:38 +00:00
{{/* Documentation: https://hugoblox.com/blocks/ */}}
{{/* License: https://github.com/HugoBlox/hugo-blox-builder/blob/main/LICENSE.md */}}
2023-10-24 18:31:41 +01:00
{{/* Initialise */}}
{{ $page := .wcPage }}
{{ $block := .wcBlock }}
{{ $author := $block.content.username | default "admin" }}
{{ $person_page_path := (printf "/authors/%s" $author) }}
{{ $person_page := site.GetPage $person_page_path }}
{{ if not $person_page }}
2023-11-09 14:58:28 +00:00
{{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://docs.hugoblox.com/page-builder/#about " $person_page_path }}
2023-10-24 18:31:41 +01:00
{{end}}
{{ $person := $person_page.Params }}
{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
{{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }}
2023-11-13 18:34:53 +00:00
{{ $img := "" }}
{{with $block.design.banner.filename}}
{{- $img = resources.Get (path.Join "media" .) -}}
{{ if $img }}
{{- $img = $img.Process "webp" -}}
< div class = "w-full bg-gray-200 dark:bg-gray-900 flex flex-wrap items-center justify-center" >
< div class = "w-full bg-white rounded dark:bg-gray-800" >
< div class = "h-2/4 sm:h-64 overflow-hidden w-full" >
< img class = "w-full object-cover"
src="{{$img.RelPermalink}}"
width="{{$img.Width}}" height="{{$img.Height}}"
alt="" />
< / div >
< / div >
< / div >
{{ end }}
{{ end }}
2023-10-24 18:31:41 +01:00
2023-11-13 18:34:53 +00:00
< div id = "profile" class = "flex justify-center items-center flex-col" >
2023-10-24 18:31:41 +01:00
{{ if $avatar }}
2023-11-13 18:34:53 +00:00
< div class = "avatar-wrapper {{ if $img }}-mt-[105px]{{else}}mt-10{{end}}" >
2023-10-24 18:31:41 +01:00
{{ $avatar_image := $avatar.Fill "150x150 Center" }}
2023-11-13 18:34:53 +00:00
< img class = "avatar rounded-full bg-white dark:bg-gray-800 p-1" src = "{{ $avatar_image.RelPermalink }}" alt = "{{$person_page.Title}}"
2023-10-24 18:31:41 +01:00
width="{{ $avatar_image.Width }}" height="{{ $avatar_image.Height }}">
{{with $person.status.icon}}< span class = "avatar-emoji" > {{.|emojify}}< / span > {{end}}
< / div >
{{ end }}
2023-12-14 23:55:19 +00:00
< div class = "portrait-title dark:text-white" >
2023-10-24 18:31:41 +01:00
2023-11-25 20:34:49 +00:00
< div class = "text-3xl font-bold mb-2 mt-6" >
2023-10-24 18:31:41 +01:00
{{- if $person.name_pronunciation -}}
< ruby >
< rb > {{ $person_page.Title }}< / rb >
< rt > {{ $person.name_pronunciation }}< / rt >
< / ruby >
{{- else -}}
{{- $person_page.Title -}}
{{- end -}}
2023-11-13 18:34:53 +00:00
< / div >
2023-10-24 18:31:41 +01:00
2023-11-13 18:34:53 +00:00
{{ with $person.role }}< h3 class = "font-semibold mb-1" > {{ . | markdownify | emojify }}< / h3 > {{ end }}
2023-10-24 18:31:41 +01:00
{{ range $person.organizations }}
2023-11-13 18:34:53 +00:00
< div class = "mb-2" >
2023-10-24 18:31:41 +01:00
{{ with .url }}< a href = "{{ . }}" target = "_blank" rel = "noopener" > {{ end }}
2023-11-13 18:34:53 +00:00
< div > {{ .name }}< / div >
2023-10-24 18:31:41 +01:00
{{ if .url }}< / a > {{ end }}
2023-11-13 18:34:53 +00:00
< / div >
2023-10-24 18:31:41 +01:00
{{ end }}
< / div >
2023-12-14 23:55:19 +00:00
< ul class = "network-icon dark:text-zinc-100" >
2023-11-25 19:53:14 +00:00
{{ range $person.profiles }}
2023-10-24 18:31:41 +01:00
{{ $pack := or .icon_pack "fas" }}
{{ $pack_prefix := $pack }}
{{ if in (slice "fab" "fas" "far" "fal") $pack }}
{{ $pack_prefix = "fa" }}
{{ end }}
2023-11-24 23:16:21 +00:00
{{ $link := .url | default .link }}
2023-10-24 18:31:41 +01:00
{{ $scheme := (urls.Parse $link).Scheme }}
{{ $target := "" }}
{{ if not $scheme }}
2023-11-24 23:16:21 +00:00
{{ $link = (.url | default .link) | relLangURL }}
2023-10-24 18:31:41 +01:00
{{ if eq (path.Ext $link) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end }}
{{ else if in (slice "http" "https") $scheme }}
{{ $target = "target=\"_blank\" rel=\"noopener\"" }}
{{ end }}
< li >
< a href = "{{ $link | safeURL }}" { { $ target | safeHTMLAttr } } aria-label = "{{ .icon }}"
{{ with .label }} data-toggle="tooltip" data-placement="top" title="{{.}}"{{ end }}>
2023-10-29 09:18:33 +00:00
{{ partial "functions/get_icon" (dict "name" .icon "attributes" "style=\"height: 1.5rem;\"") }}
2023-10-24 18:31:41 +01:00
< / a >
< / li >
{{ end }}
< / ul >
{{ with ($block.content.text | emojify | $page.RenderString) | default $person_page.Content }}
< div class = "pt-2 d-flex justify-content-center prose prose-slate lg:prose-xl dark:prose-invert" >
2023-11-25 19:53:14 +00:00
< div class = "bio-text" { { with $ block . design . biography . style } } { { ( printf " style = \"%s\"" . ) | safe . HTMLAttr } } { { end } } >
2023-10-24 18:31:41 +01:00
{{ . }}
< / div >
< / div >
{{ end }}
2023-11-13 18:34:53 +00:00
{{ with $block.content.button }}
2023-11-25 19:53:14 +00:00
< a href = "{{.url}}" target = "_blank" class = "inline-flex items-center px-4 py-2 text-sm font-medium text-gray-900 bg-white border border-gray-200 rounded-lg hover:bg-gray-100 hover:text-primary-700 focus:z-10 focus:ring-4 focus:outline-none focus:ring-gray-200 focus:text-primary-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700" > < svg class = "w-3.5 h-3.5 me-2.5" aria-hidden = "true" xmlns = "http://www.w3.org/2000/svg" fill = "currentColor" viewBox = "0 0 20 20" >
2023-11-13 18:34:53 +00:00
< path d = "M14.707 7.793a1 1 0 0 0-1.414 0L11 10.086V1.5a1 1 0 0 0-2 0v8.586L6.707 7.793a1 1 0 1 0-1.414 1.414l4 4a1 1 0 0 0 1.416 0l4-4a1 1 0 0 0-.002-1.414Z" / >
< path d = "M18 12h-2.55l-2.975 2.975a3.5 3.5 0 0 1-4.95 0L4.55 12H2a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2Zm-3 5a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z" / >
2023-11-24 23:16:21 +00:00
< / svg > {{.text}}< / a >
2023-11-13 18:34:53 +00:00
{{ end }}
2023-10-24 18:31:41 +01:00
< / div >