{{/* Hugo Blox: Biography 3 */}} {{/* Documentation: https://hugoblox.com/blocks/ */}} {{/* License: https://github.com/HugoBlox/kit/blob/main/LICENSE.md */}} {{/* Initialise */}} {{ $page := .wcPage }} {{ $block := .wcBlock }} {{ $content := $block.content }} {{ if not (reflect.IsMap $content) }}{{ $content = dict }}{{ end }} {{ $design := $block.design }} {{ if not (reflect.IsMap $design) }}{{ $design = dict }}{{ end }} {{ $author := "me" }} {{ $authorRaw := index $content "username" }} {{ if eq (printf "%T" $authorRaw) "string" }} {{ $author = $authorRaw }} {{ end }} {{ $profile := partial "functions/get_author_profile" $author }} {{ $avatar := $profile.avatar }} {{ $headings := index $content "headings" }} {{ if not (reflect.IsMap $headings) }}{{ $headings = dict }}{{ end }} {{/* Avatar customization parameters */}} {{ $avatar_size := "large" }} {{ $avatar_shape := "circle" }} {{ $avatar_config := index $design "avatar" }} {{ if and $avatar_config (reflect.IsMap $avatar_config) }} {{ $avatar_size_raw := index $avatar_config "size" }} {{ if eq (printf "%T" $avatar_size_raw) "string" }} {{ $avatar_size = $avatar_size_raw }} {{ end }} {{ $avatar_shape_raw := index $avatar_config "shape" }} {{ if eq (printf "%T" $avatar_shape_raw) "string" }} {{ $avatar_shape = $avatar_shape_raw }} {{ end }} {{ end }} {{/* Profile name typography */}} {{ $name_size := "lg" }} {{ $name_config := index $design "name" }} {{ if and $name_config (reflect.IsMap $name_config) }} {{ $name_size_raw := index $name_config "size" }} {{ if eq (printf "%T" $name_size_raw) "string" }} {{ $name_size = $name_size_raw }} {{ end }} {{ end }} {{ $name_class_map := dict "xs" "text-xl sm:text-2xl lg:text-3xl" "sm" "text-2xl sm:text-3xl lg:text-4xl" "md" "text-3xl sm:text-4xl lg:text-5xl" "lg" "text-4xl sm:text-5xl lg:text-6xl" "xl" "text-5xl sm:text-6xl lg:text-7xl" }} {{ $name_class := index $name_class_map $name_size | default (index $name_class_map "lg") }} {{/* Size mappings optimized for 2025 standards: display_size -> [display_px, generation_px] */}} {{ $size_map := dict "small" (slice "150" "300") "medium" (slice "200" "400") "large" (slice "320" "640") "xl" (slice "400" "800") "xxl" (slice "500" "1000") }} {{ $size_config := index $size_map $avatar_size | default (index $size_map "large") }} {{ $display_size := index $size_config 0 }} {{ $generation_size := index $size_config 1 }} {{/* Shape class mappings */}} {{ $shape_classes := dict "circle" "rounded-full" "square" "rounded-none" "rounded" "rounded-lg" }} {{ $shape_class := index $shape_classes $avatar_shape | default "rounded-full" }} {{ $banner_filename := "" }} {{ $banner_config := index $design "banner" }} {{ if and $banner_config (reflect.IsMap $banner_config) }} {{ $banner_raw := index $banner_config "filename" }} {{ if eq (printf "%T" $banner_raw) "string" }} {{ $banner_filename = $banner_raw }} {{ end }} {{ end }} {{ $bio_style := "" }} {{ $bio_config := index $design "biography" }} {{ if and $bio_config (reflect.IsMap $bio_config) }} {{ $bio_style_raw := index $bio_config "style" }} {{ if eq (printf "%T" $bio_style_raw) "string" }} {{ $bio_style = $bio_style_raw }} {{ end }} {{ end }}
({{ . }})
{{ end }} {{ $role_text := "" }} {{ with $profile.role }} {{ if eq (printf "%T" .) "string" }} {{ $role_text = . }} {{ end }} {{ end }} {{ with $role_text }}{{ . | markdownify | emojify }}
{{ end }} {{ $affiliations_raw := $profile.affiliations }} {{ $affiliations := slice }} {{ if reflect.IsSlice $affiliations_raw }} {{ $affiliations = $affiliations_raw }} {{ else if eq (printf "%T" $affiliations_raw) "string" }} {{ $affiliations = slice $affiliations_raw }} {{ end }} {{ range $affiliations }} {{ $aff_name := "" }} {{ $aff_url := "" }} {{ if reflect.IsMap . }} {{ $nameRaw := index . "name" | default (index . "title") }} {{ if ne $nameRaw nil }} {{ $aff_name = printf "%v" $nameRaw }} {{ end }} {{ $urlRaw := index . "url" }} {{ if eq (printf "%T" $urlRaw) "string" }} {{ $aff_url = $urlRaw }} {{ end }} {{ else if eq (printf "%T" .) "string" }} {{ $aff_name = . }} {{ end }} {{ $aff_name = strings.TrimSpace $aff_name }} {{ $aff_url = strings.TrimSpace $aff_url }} {{ if $aff_name }}{{ if $aff_url }} {{ $link := $aff_url }} {{ $scheme := (urls.Parse $link).Scheme }} {{ $target := "" }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ 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 }} {{ $aff_name }} {{ else }} {{ $aff_name }} {{ end }}
{{ end }} {{ end }}{{ $degree }}
{{ end }} {{ if $year }}{{ $year }}
{{ else if $start }}
{{ $start }}
{{ if $end }}
{{ $end }}{{ end }}
{{ $institution }}
{{ end }}