{{/* Hugo Blox: Research Areas Block */}} {{/* 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 }} {{ $layout := "cards" }} {{ $layout_raw := index $design "layout" }} {{ if eq (printf "%T" $layout_raw) "string" }} {{ $layout_candidate := lower (strings.TrimSpace $layout_raw) }} {{ if in (slice "cards" "hexagon" "timeline") $layout_candidate }} {{ $layout = $layout_candidate }} {{ end }} {{ end }} {{ $title := "" }} {{ $title_raw := index $content "title" }} {{ if $title_raw }} {{ $title = strings.TrimSpace (printf "%v" $title_raw) }} {{ end }} {{ if $title }}{{ $title = $title | emojify | $page.RenderString }}{{ end }} {{ $subtitle := "" }} {{ $subtitle_raw := index $content "subtitle" }} {{ if $subtitle_raw }} {{ $subtitle = strings.TrimSpace (printf "%v" $subtitle_raw) }} {{ end }} {{ if $subtitle }}{{ $subtitle = $subtitle | emojify | $page.RenderString }}{{ end }} {{ $text := "" }} {{ $text_raw := index $content "text" }} {{ if $text_raw }} {{ $text = strings.TrimSpace (printf "%v" $text_raw) }} {{ end }} {{ if $text }}{{ $text = $text | emojify | $page.RenderString }}{{ end }} {{ $items_raw := index $content "items" }} {{ $items_iter := slice }} {{ if reflect.IsSlice $items_raw }} {{ $items_iter = $items_raw }} {{ else if and $items_raw (reflect.IsMap $items_raw) }} {{ $items_iter = slice $items_raw }} {{ end }} {{ $items := slice }} {{ if gt (len $items_iter) 0 }} {{ range $items_iter }} {{ if reflect.IsMap . }} {{ $name := "" }} {{ $description := "" }} {{ $icon := "" }} {{ $image := "" }} {{ $gradient := "" }} {{ $url := "" }} {{ $status := "" }} {{ $topics := slice }} {{ $team_size := "" }} {{ $publications := "" }} {{ $funding := "" }} {{ $cta_url := "" }} {{ $cta_text := "" }} {{ $cta_icon := "" }} {{ with index . "name" }}{{ $name = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "description" }}{{ $description = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "icon" }}{{ $icon = printf "%v" . }}{{ end }} {{ with index . "image" }}{{ $image = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "gradient" }}{{ $gradient = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "url" }}{{ $url = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "status" }}{{ $status = lower (strings.TrimSpace (printf "%v" .)) }}{{ end }} {{ $topics_raw := index . "topics" }} {{ if reflect.IsSlice $topics_raw }} {{ range $topics_raw }} {{ $topic := strings.TrimSpace (printf "%v" .) }} {{ if $topic }}{{ $topics = $topics | append $topic }}{{ end }} {{ end }} {{ else if eq (printf "%T" $topics_raw) "string" }} {{ $topic_string := strings.TrimSpace $topics_raw }} {{ if $topic_string }} {{ if strings.Contains $topic_string "," }} {{ range (split $topic_string ",") }} {{ $topic := strings.TrimSpace . }} {{ if $topic }}{{ $topics = $topics | append $topic }}{{ end }} {{ end }} {{ else }} {{ $topics = slice $topic_string }} {{ end }} {{ end }} {{ end }} {{ with index . "team_size" }}{{ $team_size = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "publications" }}{{ $publications = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "funding" }}{{ $funding = strings.TrimSpace (printf "%v" .) }}{{ end }} {{/* Generic metrics array: [{ icon, value, label }, ...] — first 3 rendered */}} {{ $metrics := slice }} {{ $metrics_raw := index . "metrics" }} {{ if reflect.IsSlice $metrics_raw }} {{ range $metrics_raw }} {{ if reflect.IsMap . }} {{ $m_icon := "" }} {{ $m_value := "" }} {{ $m_label := "" }} {{ with index . "icon" }}{{ $m_icon = printf "%v" . }}{{ end }} {{ with index . "value" }}{{ $m_value = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index . "label" }}{{ $m_label = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ if or $m_value $m_label }} {{ $metrics = $metrics | append (dict "icon" $m_icon "value" $m_value "label" $m_label) }} {{ end }} {{ end }} {{ end }} {{ end }} {{/* Backcompat: synthesise from legacy team_size / publications / funding when `metrics` not provided */}} {{ if not $metrics }} {{ if $team_size }} {{ $metrics = $metrics | append (dict "icon" "hero/user-group" "value" (replaceRE " researchers" "" $team_size) "label" "team") }} {{ end }} {{ if $publications }} {{ $metrics = $metrics | append (dict "icon" "hero/document-text" "value" (replaceRE " papers" "" $publications) "label" "papers") }} {{ end }} {{ if $funding }} {{ $metrics = $metrics | append (dict "icon" "hero/currency-dollar" "value" $funding "label" "funding") }} {{ end }} {{ end }} {{ $cta_raw := index . "cta" }} {{ if reflect.IsMap $cta_raw }} {{ with index $cta_raw "url" }}{{ $cta_url = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $cta_raw "text" }}{{ $cta_text = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $cta_raw "icon" }}{{ $cta_icon = printf "%v" . }}{{ end }} {{ end }} {{ if or $name $description }} {{ $items = $items | append (dict "name" $name "description" $description "icon" $icon "image" $image "gradient" $gradient "url" $url "status" $status "topics" $topics "metrics" $metrics "team_size" $team_size "publications" $publications "funding" $funding "cta" (dict "url" $cta_url "text" $cta_text "icon" $cta_icon)) }} {{ end }} {{ end }} {{ end }} {{ end }} {{ $cta := index $content "cta" }} {{ if not (reflect.IsMap $cta) }}{{ $cta = dict }}{{ end }} {{ $cta_text := "" }} {{ $cta_link := "" }} {{ $cta_icon := "" }} {{ with index $cta "text" }}{{ $cta_text = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $cta "url" }}{{ $cta_link = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $cta "icon" }}{{ $cta_icon = printf "%v" . }}{{ end }}
{{/* Section Header */}}
{{ with $title }}

{{ . }}

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

{{ . }}

{{ end }} {{ with $text }}

{{ . }}

{{ end }}
{{/* Cards Layout */}} {{ if eq $layout "cards" }}
{{ range $idx, $item := $items }} {{ $name := index $item "name" }} {{ $description := index $item "description" }} {{ $icon := index $item "icon" }} {{ $image := index $item "image" }} {{ $gradient := index $item "gradient" | default "from-primary-400 to-secondary-400" }} {{ $item_url := index $item "url" }} {{ $status := index $item "status" }} {{ $topics := index $item "topics" }} {{ $metrics := index $item "metrics" }} {{ $item_cta := index $item "cta" }} {{ $item_cta_url := "" }} {{ $item_cta_text := "" }} {{ $item_cta_icon := "" }} {{ if reflect.IsMap $item_cta }} {{ with index $item_cta "url" }}{{ $item_cta_url = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $item_cta "text" }}{{ $item_cta_text = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $item_cta "icon" }}{{ $item_cta_icon = printf "%v" . }}{{ end }} {{ end }}
{{/* Card Image/Icon Header */}} {{ $header_content := "" }} {{ if $image }} {{/* Resolve image from page bundle, site assets, remote, or static URLs */}} {{ $image_resource := false }} {{ $image_url := "" }} {{ $image_path := strings.TrimSpace (printf "%v" $image) }} {{ $is_remote := or (strings.HasPrefix $image_path "http://") (strings.HasPrefix $image_path "https://") }} {{ if $is_remote }} {{ $remote := try (resources.GetRemote $image_path) }} {{ if and $remote (not $remote.Err) }} {{ $image_resource = $remote.Value }} {{ else }} {{ $image_url = $image_path }} {{ end }} {{ else }} {{ $image_path = strings.TrimPrefix "/" $image_path }} {{ $image_path = strings.TrimPrefix "./" $image_path }} {{ $image_path = strings.TrimPrefix "assets/" $image_path }} {{ $image_path = strings.TrimPrefix "media/" $image_path }} {{ $normalized := path.Clean $image_path }} {{ if and $normalized (ne $normalized ".") }} {{ with $page }} {{ $image_resource = (.Resources.ByType "image").GetMatch $normalized }} {{ end }} {{ if not $image_resource }} {{ $image_resource = resources.Get (path.Join "media" $normalized) }} {{ end }} {{ if not $image_resource }} {{ $image_url = printf "/media/%s" $normalized }} {{ end }} {{ end }} {{ end }} {{ $img := $image_resource }} {{ if $img }} {{ if reflect.IsImageResourceProcessable $img }} {{ $img = $img.Fill "600x400 Center webp" }} {{ end }} {{ $alt := $name | plainify }} {{ $header_content = printf "\"%s\"" $img.RelPermalink $alt }} {{ else if $image_url }} {{ $alt := $name | plainify }} {{ $is_external := or (strings.HasPrefix $image_url "http://") (strings.HasPrefix $image_url "https://") }} {{ $src := cond $is_external $image_url ($image_url | relURL) }} {{ $header_content = printf "\"%s\"" $src $alt }} {{ end }} {{ else if $icon }} {{ $icon_html := partial "functions/get_icon" (dict "name" $icon "attributes" "class=\"w-24 h-24 text-white/80 group-hover:scale-110 transition-transform duration-300\"") }} {{ $header_content = printf "
%s
" $icon_html }} {{ end }} {{ $item_cta_link := "" }} {{ $item_cta_target := "" }} {{ if $item_cta_url }} {{ $item_cta_link = $item_cta_url }} {{ $item_cta_scheme := (urls.Parse $item_cta_link).Scheme }} {{ if not $item_cta_scheme }} {{ if not (hasPrefix $item_cta_link "#") }} {{ $item_cta_link = $item_cta_link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $item_cta_scheme }} {{ $item_cta_target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ end }} {{ if and $item_cta_link $header_content }} {{ $header_content | safeHTML }} {{ else }}
{{ $header_content | safeHTML }}
{{ end }} {{/* Status Badge */}} {{ with $status }}
{{ . | title }}
{{ end }} {{/* Card Content - Flexible layout */}}
{{/* Main Content */}}

{{ if $item_url }} {{ $item_link := $item_url }} {{ $item_target := "" }} {{ $item_scheme := (urls.Parse $item_link).Scheme }} {{ if not $item_scheme }} {{ if not (hasPrefix $item_link "#") }} {{ $item_link = $item_link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $item_scheme }} {{ $item_target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ $name }} {{ partial "functions/get_icon" (dict "name" "hero/arrow-top-right-on-square" "attributes" "class=\"inline-block w-4 h-4 ml-1\"") }} {{ else }} {{ $name }} {{ end }}

{{ $description | $page.RenderString }}

{{/* Key Topics/Keywords */}} {{ with $topics }}
{{ range first 3 . }} {{ . }} {{ end }} {{ if gt (len .) 3 }} +{{ sub (len .) 3 }} more {{ end }}
{{ end }}
{{/* Footer Section - Always at bottom */}}
{{/* Stats/Metrics — generic icon/value/label, max 3 */}} {{ with $metrics }}
{{ range first 3 . }}
{{ with index . "icon" }} {{ partial "functions/get_icon" (dict "name" . "attributes" "class=\"w-4 h-4 mx-auto mb-1\"") }} {{ end }} {{ with index . "value" }}{{ . }}{{ end }} {{ with index . "label" }}{{ . }}{{ end }}
{{ end }}
{{ end }} {{/* Call to Action */}} {{ if and $item_cta_link $item_cta_text }} {{ $item_cta_text }} {{ partial "functions/get_icon" (dict "name" "hero/arrow-right" "attributes" "class=\"ml-1 w-4 h-4\"") }} {{ end }}
{{ end }}
{{/* Hexagon Layout */}} {{ else if eq $layout "hexagon" }}
{{ range $idx, $item := $items }} {{ $name := index $item "name" }} {{ $description := index $item "description" }} {{ $icon := index $item "icon" }} {{ $gradient := index $item "gradient" | default "from-primary-400 to-secondary-400" }}
{{ if $icon }} {{ partial "functions/get_icon" (dict "name" $icon "attributes" "class=\"w-12 h-12 text-white mb-3\"") }} {{ end }}

{{ $name }}

{{ $description | truncate 60 }}

{{ end }}
{{/* Timeline Layout */}} {{ else if eq $layout "timeline" }}
{{/* Vertical Line */}}
{{ range $idx, $item := $items }} {{ $name := index $item "name" }} {{ $description := index $item "description" }} {{ $icon := index $item "icon" }}
{{/* Timeline dot */}}
{{ if $icon }}
{{ partial "functions/get_icon" (dict "name" $icon "attributes" "class=\"w-5 h-5 text-primary-600 dark:text-primary-400\"") }}
{{ end }}

{{ $name }}

{{ $description | $page.RenderString }}

{{ end }}
{{ end }} {{/* Global Call to Action */}} {{ if and $cta_link $cta_text }} {{ $cta_target := "" }} {{ $cta_scheme := (urls.Parse $cta_link).Scheme }} {{ if not $cta_scheme }} {{ if not (hasPrefix $cta_link "#") }} {{ $cta_link = $cta_link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $cta_scheme }} {{ $cta_target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ end }}
{{/* Custom CSS for Hexagon Layout */}} {{ if eq $layout "hexagon" }} {{ end }}