{{/* Hugo Blox: Logos 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 }} {{ $display_mode := "grid" }} {{ $display_raw := index $design "display_mode" }} {{ if eq (printf "%T" $display_raw) "string" }} {{ $display_mode = lower (strings.TrimSpace $display_raw) }} {{ end }} {{ if not (in (slice "grid" "carousel" "marquee") $display_mode) }} {{ $display_mode = "grid" }} {{ end }} {{ $show_pattern := partial "functions/coerce_bool" (dict "value" (index $design "show_pattern") "default" false) }} {{ $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 }} {{ $logos_raw := index $content "logos" }} {{ $logos := slice }} {{ if reflect.IsSlice $logos_raw }}{{ $logos = $logos_raw }}{{ end }} {{ $logo_folder := "" }} {{ $logo_folder_raw := index $content "logo_folder" }} {{ if eq (printf "%T" $logo_folder_raw) "string" }}{{ $logo_folder = strings.TrimSpace $logo_folder_raw }}{{ end }} {{ $cta := index $content "cta" }} {{ if not (reflect.IsMap $cta) }}{{ $cta = dict }}{{ end }} {{ $cta_text := "" }} {{ with index $cta "text" }}{{ $cta_text = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $cta_url := "" }} {{ with index $cta "url" }}{{ $cta_url = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $cta_icon := "" }} {{ with index $cta "icon" }}{{ $cta_icon = printf "%v" . }}{{ end }}
{{/* Background Pattern */}} {{ if $show_pattern }}
{{ end }}
{{/* Section Header */}}
{{ with $title }}

{{ . }}

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

{{ . }}

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

{{ . }}

{{ end }}
{{/* Grid Display Mode */}} {{ if eq $display_mode "grid" }}
{{/* Logo Items from Data */}} {{ if gt (len $logos) 0 }} {{ range $logos }} {{ if reflect.IsMap . }} {{ $name := "" }} {{ with index . "name" }}{{ $name = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $description := "" }} {{ with index . "description" }}{{ $description = printf "%v" . }}{{ end }} {{ $image_name := "" }} {{ with index . "image" }}{{ $image_name = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $link := "" }} {{ with index . "url" }}{{ $link = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $external := partial "functions/coerce_bool" (dict "value" (index . "external") "default" false) }} {{ if $link }} {{ $scheme := (urls.Parse $link).Scheme }} {{ if not $scheme }} {{ if not (hasPrefix $link "#") }} {{ $link = $link | relLangURL }} {{ end }} {{ else if in (slice "http" "https") $scheme }} {{ $external = true }} {{ end }} {{ end }}
{{ if $link }} {{ else }}
{{ end }}
{{/* Logo Image */}} {{/* Logo Image */}} {{ if $image_name }} {{/* Resolve image from page bundle, site assets, remote, or static URLs */}} {{ $image_resource := false }} {{ $image_url := "" }} {{ $image_path := strings.TrimSpace (printf "%v" $image_name) }} {{ $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 }} {{ $isProcessable := reflect.IsImageResourceProcessable $img }} {{ if $isProcessable }} {{ $img = $img.Fit "280x140 webp" }} {{ end }} {{ $name | default {{ else if $image_url }} {{ $is_external := or (strings.HasPrefix $image_url "http://") (strings.HasPrefix $image_url "https://") }} {{ $name | default {{ end }} {{ end }} {{/* Tooltip on Hover */}} {{ with $description }}
{{ . }}
{{ end }}
{{ if $link }}
{{ else }}
{{ end }}
{{ end }} {{ end }} {{/* Logo Images from Folder (Legacy Support) */}} {{ else if $logo_folder }} {{ $images := resources.Match (printf "media/%s/*.{svg,png,jpg,webp}" $logo_folder) }} {{ range $images }}
{{ $image := . }} {{ $isProcessable := reflect.IsImageResourceProcessable $image }} {{ if $isProcessable }} {{ $image = $image.Fit "280x140 webp" }} {{ end }} Partner logo
{{ end }} {{ end }}
{{/* Carousel Display Mode */}} {{ else if eq $display_mode "carousel" }}
{{/* Duplicate items for continuous scroll */}} {{ $items := slice }} {{ if gt (len $logos) 0 }} {{ range $logos }} {{ if reflect.IsMap . }} {{ $img_name := index . "image" }} {{ if eq (printf "%T" $img_name) "string" }} {{ $items = $items | append (dict "image" (strings.TrimSpace $img_name) "name" (index . "name")) }} {{ end }} {{ end }} {{ end }} {{ else if $logo_folder }} {{ $images := resources.Match (printf "media/%s/*.{svg,png,jpg,webp}" $logo_folder) }} {{ range $images }} {{ $items = $items | append (dict "image" .Name) }} {{ end }} {{ end }} {{/* First set of logos */}} {{ range $items }}
{{ if .image }} {{ $img := resources.Get (printf "media/%s" .image) }} {{ if $img }} {{ $isProcessable := reflect.IsImageResourceProcessable $img }} {{ if $isProcessable }} {{ $img = $img.Fit "280x140 webp" }} {{ end }} {{ .name | default {{ end }} {{ end }}
{{ end }} {{/* Duplicate for seamless loop */}} {{ range $items }}
{{ if .image }} {{ $img := resources.Get (printf "media/%s" .image) }} {{ if $img }} {{ $isProcessable := reflect.IsImageResourceProcessable $img }} {{ if $isProcessable }} {{ $img = $img.Fit "280x140 webp" }} {{ end }} {{ .name | default {{ end }} {{ end }}
{{ end }}
{{/* Marquee Display Mode */}} {{ else if eq $display_mode "marquee" }}
{{ if gt (len $logos) 0 }} {{ range $logos }} {{ if reflect.IsMap . }} {{ $image_name := "" }} {{ with index . "image" }}{{ $image_name = strings.TrimSpace (printf "%v" .) }}{{ end }} {{ $name := "" }} {{ with index . "name" }}{{ $name = strings.TrimSpace (printf "%v" .) }}{{ end }}
{{ if $image_name }} {{ $img := resources.Get (printf "media/%s" $image_name) }} {{ if $img }} {{ $isProcessable := reflect.IsImageResourceProcessable $img }} {{ if $isProcessable }} {{ $img = $img.Fit "280x140 webp" }} {{ end }} {{ $name | default {{ end }} {{ end }}
{{ end }} {{ end }} {{ end }}
{{ end }} {{/* Call to Action */}} {{ if and $cta_text $cta_url }} {{ $link := $cta_url }} {{ $target := "" }} {{ $scheme := (urls.Parse $link).Scheme }} {{ 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 }} {{ end }}
{{/* Custom CSS for Animations */}}