{{/* Hugo Blox: Team Showcase */}} {{/* 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 }} {{ $show_social := partial "functions/coerce_bool" (dict "value" (index $design "show_social") "default" true) }} {{ $show_interests := partial "functions/coerce_bool" (dict "value" (index $design "show_interests") "default" false) }} {{ $show_role := partial "functions/coerce_bool" (dict "value" (index $design "show_role") "default" true) }} {{ $show_organizations := partial "functions/coerce_bool" (dict "value" (index $design "show_organizations") "default" true) }} {{ $show_empty_groups := partial "functions/coerce_bool" (dict "value" (index $design "show_empty_groups") "default" false) }} {{ $max_interests_int := partial "functions/coerce_int" (dict "value" (index $design "max_interests") "default" 3 "min" 0) }} {{ $max_columns_int := partial "functions/coerce_int" (dict "value" (index $design "max_columns") "default" 4 "min" 2 "max" 4) }} {{ $align := "center" }} {{ $align_raw := index $design "align" }} {{ if eq (printf "%T" $align_raw) "string" }} {{ $align_candidate := lower (strings.TrimSpace $align_raw) }} {{ if in (slice "center" "left") $align_candidate }} {{ $align = $align_candidate }} {{ end }} {{ end }} {{ $sort_field := "name_family" }} {{ $sort_field_raw := index $content "sort_by" }} {{ if eq (printf "%T" $sort_field_raw) "string" }} {{ $sort_field_raw = strings.TrimSpace $sort_field_raw }} {{ if ne $sort_field_raw "" }} {{ $sort_field = $sort_field_raw }} {{ end }} {{ end }} {{ $sort_asc := partial "functions/coerce_bool" (dict "value" (index $content "sort_ascending") "default" true) }} {{ $sort_field_lc := lower $sort_field }} {{ if hasPrefix $sort_field_lc "params." }} {{/* Backwards compatibility with Params.* used when authors were pages */}} {{ $sort_field = substr $sort_field 7 }} {{ $sort_field_lc = lower $sort_field }} {{ end }} {{ $title := "" }} {{ with index $content "title" }}{{ $title = printf "%v" . | emojify | $page.RenderString }}{{ end }} {{ $subtitle := "" }} {{ with index $content "subtitle" }}{{ $subtitle = printf "%v" . | emojify | $page.RenderString }}{{ end }} {{ $text := "" }} {{ with index $content "text" }}{{ $text = printf "%v" . | emojify | $page.RenderString }}{{ end }} {{ $headerContainerClass := cond (eq $align "left") "max-w-3xl mb-12 text-left" "text-center max-w-3xl mx-auto mb-12" }} {{ $ctaAlignClass := cond (eq $align "left") "text-left" "text-center" }} {{ $columnsClasses := dict "2" "grid grid-cols-1 gap-8 sm:grid-cols-2" "3" "grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3" "4" "grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" }} {{ $max_columns_key := printf "%d" $max_columns_int }} {{ $gridClass := index $columnsClasses $max_columns_key | default "grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4" }}
{{/* Section Header */}}
{{ with $title }}

{{ . }}

{{ end }} {{ with $subtitle }}

{{ . }}

{{ end }} {{ with $text }}
{{ . }}
{{ end }}
{{/* Build profiles from data/authors */}} {{ $allProfiles := slice }} {{ $authors := partialCached "functions/get_authors_data" $page site.Language.Lang }} {{ range $slug, $_ := $authors }} {{ $profile := partial "functions/get_author_profile" (dict "slug" $slug) }} {{ $profileData := index $authors $slug }} {{ $allProfiles = $allProfiles | append (dict "profile" $profile "profileData" $profileData) }} {{ end }} {{ $groups_raw := index $content "user_groups" }} {{ $groups := slice }} {{ if reflect.IsSlice $groups_raw }} {{ $groups = $groups_raw }} {{ else if eq (printf "%T" $groups_raw) "string" }} {{ $groups = slice $groups_raw }} {{ else if and $groups_raw (reflect.IsMap $groups_raw) }} {{ $groups = slice $groups_raw }} {{ end }} {{ if gt (len $groups) 0 }} {{ range $i, $groupItem := $groups }} {{ $groupName := "" }} {{ $groupSortField := $sort_field }} {{ $groupSortAsc := $sort_asc }} {{ $groupSortFieldLc := "" }} {{ $itemIsMap := reflect.IsMap $groupItem }} {{ if $itemIsMap }} {{ $groupNameRaw := index $groupItem "name" | default (index $groupItem "title") }} {{ if ne $groupNameRaw nil }} {{ $groupName = printf "%v" $groupNameRaw }} {{ end }} {{ $groupSortFieldRaw := index $groupItem "sort_by" }} {{ if eq (printf "%T" $groupSortFieldRaw) "string" }} {{ $groupSortFieldRaw = strings.TrimSpace $groupSortFieldRaw }} {{ if ne $groupSortFieldRaw "" }} {{ $groupSortField = $groupSortFieldRaw }} {{ end }} {{ end }} {{ $groupSortAsc = partial "functions/coerce_bool" (dict "value" (index $groupItem "sort_ascending") "default" $groupSortAsc) }} {{ else }} {{ $groupName = printf "%v" $groupItem }} {{ end }} {{ $groupName = strings.TrimSpace $groupName }} {{ if eq (trim $groupName " ") "" }} {{/* Skip groups with empty names to avoid matching everything */}} {{ continue }} {{ end }} {{ $groupSortFieldLc = lower $groupSortField }} {{ if hasPrefix $groupSortFieldLc "params." }} {{ $groupSortField = substr $groupSortField 7 }} {{ $groupSortFieldLc = lower $groupSortField }} {{ end }} {{ $groupIsNumeric := or (eq $groupSortFieldLc "weight") (eq $groupSortFieldLc "graduation_year") }} {{ $groupOrder := cond $groupSortAsc "asc" "desc" }} {{ $groupProfiles := slice }} {{ range $allProfiles }} {{ $profile := .profile }} {{ $u := slice }} {{ $uRaw := $profile.user_groups }} {{ if reflect.IsSlice $uRaw }} {{ range $uRaw }} {{ $u = $u | append (printf "%v" .) }} {{ end }} {{ else if eq (printf "%T" $uRaw) "string" }} {{ $trimmedGroup := strings.TrimSpace $uRaw }} {{ if ne $trimmedGroup "" }} {{ $u = slice $trimmedGroup }} {{ end }} {{ end }} {{ if gt (len (intersect $u (slice (printf "%v" $groupName)))) 0 }} {{ $profileData := .profileData }} {{ $family := $profile.name_family_pref | default $profile.name_family | default (delimit (last 1 (split $profile.title " ")) "") | default $profile.title }} {{ $familyLower := lower $family }} {{ $raw := index $profile $groupSortField | default (index $profileData $groupSortField) }} {{ $rawType := printf "%T" $raw }} {{ $isNumeric := $groupIsNumeric }} {{ $primary := "" }} {{ if or (eq $groupSortFieldLc "name.family") (eq $groupSortFieldLc "family") (eq $groupSortFieldLc "last_name") (eq $groupSortFieldLc "name_family") (eq $groupSortFieldLc "family_name") }} {{ $primary = $familyLower }} {{ else if $isNumeric }} {{ $missingSentinel := cond $groupSortAsc 999999 -999999 }} {{ $primary = $missingSentinel }} {{ if or (eq $rawType "int") (eq $rawType "int64") (eq $rawType "float64") (eq $rawType "float32") (eq $rawType "uint") (eq $rawType "uint64") }} {{ $primary = int $raw }} {{ else if and (eq $rawType "string") (gt (len (findRE "^[0-9]+$" $raw)) 0) }} {{ $primary = int $raw }} {{ end }} {{ else if ne $raw nil }} {{ $primary = lower (printf "%v" $raw) }} {{ else }} {{ $primary = lower $profile.title }} {{ end }} {{ $sortKey := "" }} {{ if $isNumeric }} {{ $missingSentinel := cond $groupSortAsc 999999 -999999 }} {{ $num := $primary | default $missingSentinel }} {{ $sortKey = printf "%010d|%s" $num $familyLower }} {{ else }} {{ $sortKey = printf "%s|%s" $primary $familyLower }} {{ end }} {{ $groupProfiles = $groupProfiles | append (dict "profile" $profile "sort_val" $sortKey) }} {{ end }} {{ end }} {{ $groupProfiles = sort $groupProfiles "sort_val" $groupOrder }} {{ $hasGroupContent := or (gt (len $groupProfiles) 0) $show_empty_groups }} {{ if and $hasGroupContent (gt (len $groups) 1) }}

{{ $groupName | markdownify }}

{{ end }} {{ if $hasGroupContent }}
{{ if eq (len $groupProfiles) 0 }} {{ if $show_empty_groups }}
{{ i18n "no_entries" | default "No entries yet." }}
{{ end }} {{ end }} {{ range $groupProfile := $groupProfiles }} {{ $profile := $groupProfile.profile }} {{ $avatar := $profile.avatar }} {{ $link := printf "/authors/%s/" $profile.slug }} {{ $nameSource := $profile.name_given | default $profile.title | default "?" }} {{ $initial := cond (gt (len $nameSource) 0) (upper (substr $nameSource 0 1)) "?" }}
{{ if $avatar }} {{ $image := $avatar.Fit "600x600 Center q90" }} {{ $profile.title }} {{ else }}
{{ $initial }}
{{ end }}

{{ $profile.title }}

{{ $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 }} {{ $first_affiliation := "" }} {{ if gt (len $affiliations) 0 }} {{ $aff := index $affiliations 0 }} {{ if reflect.IsMap $aff }} {{ $affNameRaw := index $aff "name" | default (index $aff "title") }} {{ if ne $affNameRaw nil }} {{ $first_affiliation = printf "%v" $affNameRaw }} {{ end }} {{ else if eq (printf "%T" $aff) "string" }} {{ $first_affiliation = $aff }} {{ end }} {{ $first_affiliation = strings.TrimSpace $first_affiliation }} {{ end }} {{ if $show_role }}
{{ $roleText := "" }} {{ with $profile.role }} {{ if eq (printf "%T" .) "string" }} {{ $roleText = . }} {{ end }} {{ end }} {{ if and (not $roleText) $first_affiliation }} {{ $roleText = $first_affiliation }} {{ end }} {{ with $roleText }}

{{ . }}

{{ end }} {{ if and $show_organizations $first_affiliation }}

{{ $first_affiliation }}

{{ end }}
{{ end }} {{ $bio := "" }} {{ with $profile.bio }}{{ $bio = printf "%v" . }}{{ end }} {{ with $bio }}

{{ . }}

{{ end }} {{ $interests_raw := $profile.interests }} {{ $interests := slice }} {{ if reflect.IsSlice $interests_raw }} {{ $interests = $interests_raw }} {{ else if eq (printf "%T" $interests_raw) "string" }} {{ $interests = slice $interests_raw }} {{ end }} {{ if and $show_interests (gt (len $interests) 0) }}
{{ if gt $max_interests_int 0 }} {{ range first $max_interests_int $interests }} {{ printf "%v" . }} {{ end }} {{ end }}
{{ end }} {{ $links_raw := $profile.links }} {{ $links := slice }} {{ if reflect.IsSlice $links_raw }} {{ $links = $links_raw }} {{ else if eq (printf "%T" $links_raw) "string" }} {{ $links = slice $links_raw }} {{ end }} {{ if and $show_social (gt (len $links) 0) }}
{{ range $links }} {{ $linkUrl := "" }} {{ $iconName := "hero/link" }} {{ $linkLabel := "" }} {{ if reflect.IsMap . }} {{ $urlRaw := index . "url" | default (index . "link") }} {{ if eq (printf "%T" $urlRaw) "string" }} {{ $linkUrl = $urlRaw }} {{ end }} {{ $iconRaw := index . "icon" }} {{ if eq (printf "%T" $iconRaw) "string" }} {{ $iconName = $iconRaw }} {{ end }} {{ $labelRaw := index . "label" }} {{ if eq (printf "%T" $labelRaw) "string" }} {{ $linkLabel = $labelRaw }} {{ end }} {{ else if eq (printf "%T" .) "string" }} {{ $linkUrl = . }} {{ end }} {{ $linkUrl = strings.TrimSpace $linkUrl }} {{ if $linkUrl }} {{ $scheme := (urls.Parse $linkUrl).Scheme }} {{ $target := "" }} {{ if not $scheme }} {{ if not (hasPrefix $linkUrl "#") }} {{ $linkUrl = $linkUrl | relLangURL }} {{ end }} {{ if eq (path.Ext $linkUrl) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ partial "functions/get_icon" (dict "name" $iconName "attributes" "class=\"w-5 h-5\"") }} {{ end }} {{ end }}
{{ end }}
{{ end }}
{{ end }} {{ end }} {{ else }} {{ $isNumeric := or (eq $sort_field_lc "weight") (eq $sort_field_lc "graduation_year") }} {{ $order := cond $sort_asc "asc" "desc" }} {{ $sorted := slice }} {{ range $allProfiles }} {{ $profile := .profile }} {{ $profileData := .profileData }} {{ $family := $profile.name_family_pref | default $profile.name_family | default (delimit (last 1 (split $profile.title " ")) "") | default $profile.title }} {{ $familyLower := lower $family }} {{ $raw := index $profile $sort_field | default (index $profileData $sort_field) }} {{ $rawType := printf "%T" $raw }} {{ $primary := "" }} {{ if or (eq $sort_field_lc "name.family") (eq $sort_field_lc "family") (eq $sort_field_lc "last_name") (eq $sort_field_lc "name_family") (eq $sort_field_lc "family_name") }} {{ $primary = $familyLower }} {{ else if $isNumeric }} {{ $missingSentinel := cond $sort_asc 999999 -999999 }} {{ $primary = $missingSentinel }} {{ if or (eq $rawType "int") (eq $rawType "int64") (eq $rawType "float64") (eq $rawType "float32") (eq $rawType "uint") (eq $rawType "uint64") }} {{ $primary = int $raw }} {{ else if and (eq $rawType "string") (gt (len (findRE "^[0-9]+$" $raw)) 0) }} {{ $primary = int $raw }} {{ end }} {{ else if ne $raw nil }} {{ $primary = lower (printf "%v" $raw) }} {{ else }} {{ $primary = lower $profile.title }} {{ end }} {{ $sortKey := "" }} {{ if $isNumeric }} {{ $missingSentinel := cond $sort_asc 999999 -999999 }} {{ $num := $primary | default $missingSentinel }} {{ $sortKey = printf "%010d|%s" $num $familyLower }} {{ else }} {{ $sortKey = printf "%s|%s" $primary $familyLower }} {{ end }} {{ $sorted = $sorted | append (dict "profile" $profile "sort_val" $sortKey) }} {{ end }} {{ $sorted = sort $sorted "sort_val" $order }}
{{ range $sortedProfile := $sorted }} {{ $profile := $sortedProfile.profile }} {{ $avatar := $profile.avatar }} {{ $link := printf "/authors/%s/" $profile.slug }} {{ $nameSource := $profile.name_given | default $profile.title | default "?" }} {{ $initial := cond (gt (len $nameSource) 0) (upper (substr $nameSource 0 1)) "?" }}
{{ if $avatar }} {{ $image := $avatar.Fit "600x600 Center q90" }} {{ $profile.title }} {{ else }}
{{ $initial }}
{{ end }}

{{ $profile.title }}

{{ $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 }} {{ $first_affiliation := "" }} {{ if gt (len $affiliations) 0 }} {{ $aff := index $affiliations 0 }} {{ if reflect.IsMap $aff }} {{ $affNameRaw := index $aff "name" | default (index $aff "title") }} {{ if ne $affNameRaw nil }} {{ $first_affiliation = printf "%v" $affNameRaw }} {{ end }} {{ else if eq (printf "%T" $aff) "string" }} {{ $first_affiliation = $aff }} {{ end }} {{ $first_affiliation = strings.TrimSpace $first_affiliation }} {{ end }} {{ if $show_role }}
{{ $roleText := "" }} {{ with $profile.role }} {{ if eq (printf "%T" .) "string" }} {{ $roleText = . }} {{ end }} {{ end }} {{ if and (not $roleText) $first_affiliation }} {{ $roleText = $first_affiliation }} {{ end }} {{ with $roleText }}

{{ . }}

{{ end }} {{ if and $show_organizations $first_affiliation }}

{{ $first_affiliation }}

{{ end }}
{{ end }} {{ $bio := "" }} {{ with $profile.bio }}{{ $bio = printf "%v" . }}{{ end }} {{ with $bio }}

{{ . }}

{{ end }} {{ $interests_raw := $profile.interests }} {{ $interests := slice }} {{ if reflect.IsSlice $interests_raw }} {{ $interests = $interests_raw }} {{ else if eq (printf "%T" $interests_raw) "string" }} {{ $interests = slice $interests_raw }} {{ end }} {{ if and $show_interests (gt (len $interests) 0) }}
{{ if gt $max_interests_int 0 }} {{ range first $max_interests_int $interests }} {{ printf "%v" . }} {{ end }} {{ end }}
{{ end }} {{ $links_raw := $profile.links }} {{ $links := slice }} {{ if reflect.IsSlice $links_raw }} {{ $links = $links_raw }} {{ else if eq (printf "%T" $links_raw) "string" }} {{ $links = slice $links_raw }} {{ end }} {{ if and $show_social (gt (len $links) 0) }}
{{ range $links }} {{ $linkUrl := "" }} {{ $iconName := "hero/link" }} {{ $linkLabel := "" }} {{ if reflect.IsMap . }} {{ $urlRaw := index . "url" | default (index . "link") }} {{ if eq (printf "%T" $urlRaw) "string" }} {{ $linkUrl = $urlRaw }} {{ end }} {{ $iconRaw := index . "icon" }} {{ if eq (printf "%T" $iconRaw) "string" }} {{ $iconName = $iconRaw }} {{ end }} {{ $labelRaw := index . "label" }} {{ if eq (printf "%T" $labelRaw) "string" }} {{ $linkLabel = $labelRaw }} {{ end }} {{ else if eq (printf "%T" .) "string" }} {{ $linkUrl = . }} {{ end }} {{ $linkUrl = strings.TrimSpace $linkUrl }} {{ if $linkUrl }} {{ $scheme := (urls.Parse $linkUrl).Scheme }} {{ $target := "" }} {{ if not $scheme }} {{ if not (hasPrefix $linkUrl "#") }} {{ $linkUrl = $linkUrl | relLangURL }} {{ end }} {{ if eq (path.Ext $linkUrl) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ partial "functions/get_icon" (dict "name" $iconName "attributes" "class=\"w-5 h-5\"") }} {{ end }} {{ end }}
{{ end }}
{{ end }}
{{ end }} {{/* Call to Action */}} {{ $cta_raw := index $content "cta" }} {{ if and $cta_raw (reflect.IsMap $cta_raw) }} {{ $cta_text := "" }} {{ $cta_url := "" }} {{ $cta_icon := "" }} {{ with index $cta_raw "text" }}{{ $cta_text = printf "%v" . }}{{ end }} {{ with index $cta_raw "url" }}{{ $cta_url = printf "%v" . }}{{ end }} {{ with index $cta_raw "icon" }} {{ if eq (printf "%T" .) "string" }} {{ $cta_icon = . }} {{ end }} {{ end }} {{ $cta_text = strings.TrimSpace $cta_text }} {{ $cta_url = strings.TrimSpace $cta_url }} {{ if and $cta_text $cta_url }} {{ $cta_link := $cta_url }} {{ $scheme := (urls.Parse $cta_link).Scheme }} {{ $target := "" }} {{ if not $scheme }} {{ if not (hasPrefix $cta_link "#") }} {{ $cta_link = $cta_link | relLangURL }} {{ end }} {{ if eq (path.Ext $cta_link) ".pdf" }}{{ $target = "target=\"_blank\" rel=\"noopener\"" }}{{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }}
{{ $cta_text }} {{ if $cta_icon }} {{ partial "functions/get_icon" (dict "name" $cta_icon "attributes" "class=\"ml-2 w-5 h-5\"") }} {{ end }}
{{ end }} {{ end }}