{{/* Hugo Blox: Dev Hero */}} {{/* 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 }} {{/* Enable animations if typewriter or scroll animations are configured */}} {{ $typewriter := index $content "typewriter" }} {{ if not (reflect.IsMap $typewriter) }}{{ $typewriter = dict }}{{ end }} {{ $typewriter_enabled := partial "functions/coerce_bool" (dict "value" (index $typewriter "enable") "default" false) }} {{ $animations_enabled := partial "functions/coerce_bool" (dict "value" (index $design "animations") "default" false) }} {{ $has_animations := or $typewriter_enabled $animations_enabled }} {{ if $has_animations }} {{ $page.Store.Set "has_animations" true }} {{ $page.Store.Set "has_alpine" true }} {{ end }} {{/* Get author data from YAML */}} {{ $username := "me" }} {{ $username_raw := index $content "username" }} {{ if eq (printf "%T" $username_raw) "string" }} {{ $username = strings.TrimSpace $username_raw }} {{ end }} {{ $author := partial "functions/get_author_profile" $username }} {{/* Get avatar */}} {{ $avatar := "" }} {{ $avatar_shape := "circle" }} {{ $avatar_shape_raw := index $design "avatar_shape" }} {{ if eq (printf "%T" $avatar_shape_raw) "string" }} {{ $avatar_shape = lower (strings.TrimSpace $avatar_shape_raw) }} {{ end }} {{ with $author.avatar }} {{ $avatar = .Fill "300x300 webp Center" }} {{ end }} {{/* Layout style */}} {{ $style := "centered" }} {{ $style_raw := index $design "style" }} {{ if eq (printf "%T" $style_raw) "string" }} {{ $style_candidate := lower (strings.TrimSpace $style_raw) }} {{ if in (slice "centered" "split") $style_candidate }} {{ $style = $style_candidate }} {{ end }} {{ end }} {{ $show_status := partial "functions/coerce_bool" (dict "value" (index $content "show_status") "default" false) }} {{ $show_scroll := partial "functions/coerce_bool" (dict "value" (index $content "show_scroll_indicator") "default" false) }} {{ $scroll_target := "#projects" }} {{ $scroll_target_raw := index $content "scroll_target" }} {{ if eq (printf "%T" $scroll_target_raw) "string" }} {{ $scroll_target = strings.TrimSpace $scroll_target_raw }} {{ end }} {{ if not $scroll_target }}{{ $scroll_target = "#projects" }}{{ end }} {{ $greeting := "" }} {{ $greeting_raw := index $content "greeting" }} {{ if eq (printf "%T" $greeting_raw) "string" }}{{ $greeting = $greeting_raw }}{{ end }} {{ $name_prefix := "" }} {{ $name_prefix_raw := index $content "name_prefix" }} {{ if eq (printf "%T" $name_prefix_raw) "string" }}{{ $name_prefix = $name_prefix_raw }}{{ end }} {{ $title_override := "" }} {{ $title_raw := index $content "title" }} {{ if eq (printf "%T" $title_raw) "string" }}{{ $title_override = strings.TrimSpace $title_raw }}{{ end }} {{ $tagline := "" }} {{ $tagline_raw := index $content "tagline" }} {{ if eq (printf "%T" $tagline_raw) "string" }}{{ $tagline = $tagline_raw }}{{ end }} {{ $bio_override := "" }} {{ $bio_raw := index $content "bio" }} {{ if eq (printf "%T" $bio_raw) "string" }}{{ $bio_override = $bio_raw }}{{ end }} {{ $role := $author.role | default $tagline }} {{ $bio := $author.bio | default $bio_override }} {{ $typewriter_strings := slice }} {{ $strings_raw := index $typewriter "strings" }} {{ if reflect.IsSlice $strings_raw }} {{ range $strings_raw }} {{ $val := strings.TrimSpace (printf "%v" .) }} {{ if $val }}{{ $typewriter_strings = $typewriter_strings | append $val }}{{ end }} {{ end }} {{ else if eq (printf "%T" $strings_raw) "string" }} {{ $val := strings.TrimSpace $strings_raw }} {{ if $val }}{{ $typewriter_strings = slice $val }}{{ end }} {{ end }} {{ $typewriter_prefix := "" }} {{ $typewriter_prefix_raw := index $typewriter "prefix" }} {{ if eq (printf "%T" $typewriter_prefix_raw) "string" }}{{ $typewriter_prefix = $typewriter_prefix_raw }}{{ end }} {{ $type_speed := partial "functions/coerce_int" (dict "value" (index $typewriter "type_speed") "default" 80 "min" 10 "max" 500) }} {{ $delete_speed := partial "functions/coerce_int" (dict "value" (index $typewriter "delete_speed") "default" 50 "min" 10 "max" 500) }} {{ $pause_time := partial "functions/coerce_int" (dict "value" (index $typewriter "pause_time") "default" 2000 "min" 200 "max" 10000) }} {{ $links_raw := $author.links | default (index $content "links") }} {{ $links := slice }} {{ if reflect.IsSlice $links_raw }} {{ range $links_raw }} {{ $url := "" }} {{ $icon := "hero/link" }} {{ $label := "" }} {{ if reflect.IsMap . }} {{ $url_raw := index . "url" | default (index . "link") }} {{ if eq (printf "%T" $url_raw) "string" }}{{ $url = strings.TrimSpace $url_raw }}{{ end }} {{ $icon_raw := index . "icon" }} {{ if eq (printf "%T" $icon_raw) "string" }}{{ $icon = $icon_raw }}{{ end }} {{ $label_raw := index . "label" | default (index . "name") }} {{ if eq (printf "%T" $label_raw) "string" }}{{ $label = $label_raw }}{{ end }} {{ else if eq (printf "%T" .) "string" }} {{ $url = strings.TrimSpace . }} {{ end }} {{ if $url }} {{ $links = $links | append (dict "url" $url "icon" $icon "label" $label) }} {{ end }} {{ end }} {{ else if eq (printf "%T" $links_raw) "string" }} {{ $url := strings.TrimSpace $links_raw }} {{ if $url }} {{ $links = slice (dict "url" $url "icon" "hero/link" "label" "") }} {{ end }} {{ end }} {{ $cta_buttons_raw := index $content "cta_buttons" }} {{ $cta_buttons := slice }} {{ if reflect.IsSlice $cta_buttons_raw }} {{ $cta_buttons = $cta_buttons_raw }} {{ else if and $cta_buttons_raw (reflect.IsMap $cta_buttons_raw) }} {{ $cta_buttons = slice $cta_buttons_raw }} {{ end }} {{ $status_icon := "" }} {{ $status := $author.status }} {{ if and $status (reflect.IsMap $status) }} {{ $status_icon_raw := index $status "icon" }} {{ if eq (printf "%T" $status_icon_raw) "string" }} {{ $status_icon = $status_icon_raw }} {{ end }} {{ end }}
{{/* Background Effects - only visible in dark mode */}} {{/* Light mode subtle background */}}
{{ if eq $style "split" }} {{/* Split layout with avatar on side */}}
{{/* Avatar */}} {{ with $avatar }}
{{ $author.title }}
{{/* Status emoji badge */}} {{ if $show_status }} {{ with $status_icon }} {{ . | emojify }} {{ end }} {{ end }} {{/* Decorative ring */}}
{{ end }} {{/* Content */}}
{{/* Greeting */}} {{ with $greeting }}

{{ . }}

{{ end }} {{/* Name */}}

{{ with $name_prefix }}{{ . }} {{ end }} {{ $author.title | default $title_override | default (i18n "developer" | default "Developer") }}

{{/* Role/Tagline with optional typewriter */}} {{ if and $typewriter_enabled (gt (len $typewriter_strings) 0) }}

{{ with $typewriter_prefix }}{{ . }} {{ end }}

{{ else if $role }}

{{ $role | $page.RenderString }}

{{ end }} {{/* Bio */}} {{ with $bio }}

{{ . | $page.RenderString }}

{{ end }} {{/* Social Links */}} {{ if gt (len $links) 0 }}
{{ range $links }} {{ $icon := index . "icon" | default "hero/link" }} {{ $url := index . "url" }} {{ $link := $url }} {{ $target := "" }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $target = "target=\"_blank\" rel=\"noopener noreferrer\"" }} {{ end }} {{ partial "functions/get_icon" (dict "name" $icon "attributes" "class=\"w-5 h-5\"") }} {{ end }}
{{ end }} {{/* CTA Buttons */}} {{ if gt (len $cta_buttons) 0 }}
{{ range $idx, $btn := $cta_buttons }} {{ if reflect.IsMap $btn }} {{ $is_primary := eq $idx 0 }} {{ $btn_text := "" }} {{ $btn_url := "" }} {{ $btn_icon := "" }} {{ $btn_new_tab := partial "functions/coerce_bool" (dict "value" (index $btn "new_tab") "default" false) }} {{ with index $btn "text" }}{{ $btn_text = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $btn "url" }}{{ $btn_url = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $btn "icon" }}{{ $btn_icon = printf "%v" . }}{{ end }} {{ if and $btn_text $btn_url }} {{ $link := $btn_url }} {{ $target := "" }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ if eq (path.Ext $link) ".pdf" }}{{ $btn_new_tab = true }}{{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $btn_new_tab = true }} {{ end }} {{ if $btn_new_tab }} {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ if $btn_icon }} {{ partial "functions/get_icon" (dict "name" $btn_icon "attributes" "class=\"w-5 h-5\"") }} {{ end }} {{ $btn_text }} {{ end }} {{ end }} {{ end }}
{{ end }}
{{ else }} {{/* Centered layout */}} {{/* Avatar */}} {{ with $avatar }}
{{ $author.title }}
{{/* Status emoji badge */}} {{ if $show_status }} {{ with $status_icon }} {{ . | emojify }} {{ end }} {{ end }}
{{ end }} {{/* Greeting */}} {{ with $greeting }}

{{ . }}

{{ end }} {{/* Name */}}

{{ with $name_prefix }}{{ . }} {{ end }} {{ $author.title | default $title_override | default (i18n "developer" | default "Developer") }}

{{/* Role/Tagline with optional typewriter */}} {{ if and $typewriter_enabled (gt (len $typewriter_strings) 0) }}

{{ with $typewriter_prefix }}{{ . }} {{ end }}

{{ else if $role }}

{{ $role | $page.RenderString }}

{{ end }} {{/* Bio */}} {{ with $bio }}

{{ . | $page.RenderString }}

{{ end }} {{/* Social Links */}} {{ if gt (len $links) 0 }}
{{ range $links }} {{ $icon := index . "icon" | default "hero/link" }} {{ $url := index . "url" }} {{ $link := $url }} {{ $target := "" }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $target = "target=\"_blank\" rel=\"noopener noreferrer\"" }} {{ end }} {{ partial "functions/get_icon" (dict "name" $icon "attributes" "class=\"w-5 h-5\"") }} {{ end }}
{{ end }} {{/* CTA Buttons */}} {{ if gt (len $cta_buttons) 0 }}
{{ range $idx, $btn := $cta_buttons }} {{ if reflect.IsMap $btn }} {{ $is_primary := eq $idx 0 }} {{ $btn_text := "" }} {{ $btn_url := "" }} {{ $btn_icon := "" }} {{ $btn_new_tab := partial "functions/coerce_bool" (dict "value" (index $btn "new_tab") "default" false) }} {{ with index $btn "text" }}{{ $btn_text = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $btn "url" }}{{ $btn_url = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ with index $btn "icon" }}{{ $btn_icon = printf "%v" . }}{{ end }} {{ if and $btn_text $btn_url }} {{ $link := $btn_url }} {{ $target := "" }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ if eq (path.Ext $link) ".pdf" }}{{ $btn_new_tab = true }}{{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $btn_new_tab = true }} {{ end }} {{ if $btn_new_tab }} {{ $target = "target=\"_blank\" rel=\"noopener\"" }} {{ end }} {{ if $btn_icon }} {{ partial "functions/get_icon" (dict "name" $btn_icon "attributes" "class=\"w-5 h-5\"") }} {{ end }} {{ $btn_text }} {{ end }} {{ end }} {{ end }}
{{ end }} {{ end }} {{/* Scroll indicator - clicks to scroll to next section */}} {{ if $show_scroll }} {{ $scroll_link := $scroll_target }} {{ $scroll_target_attr := "" }} {{ $scroll_scheme := (urls.Parse $scroll_link).Scheme }} {{ if not $scroll_scheme }} {{ if not (hasPrefix $scroll_link "#") }} {{ $scroll_link = $scroll_link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $scroll_scheme }} {{ $scroll_target_attr = "target=\"_blank\" rel=\"noopener\"" }} {{ end }}
{{ end }}