{{/* Content section rendering for embed cards Parameters: - customDescription: user-provided description override - embedData: data fetched from API - platform: platform name - hb_id: Hugo Blox unique identifier - config: platform configuration - processedImage: processed image data (for image embeds) */}} {{- $customDescription := .customDescription -}} {{- $embedData := .embedData -}} {{- $platform := .platform -}} {{- $hb_id := .hb_id -}} {{- $config := .config -}} {{- $processedImage := .processedImage -}} {{/* Display processed image if available */}} {{- if $processedImage -}}
{{ if $customDescription }}{{ $customDescription }}{{ else if and $embedData $config.titleField }}{{ index $embedData $config.titleField }}{{ else }}Embedded image{{ end }}
{{- end -}} {{/* Description handling */}} {{- $description := $customDescription -}} {{- if and (not $description) $embedData $config.descriptionField -}} {{- $description = index $embedData $config.descriptionField -}} {{/* Apply platform-specific cleanup */}} {{- if $config.descriptionCleanup -}} {{- $description = $description | replaceRE $config.descriptionCleanup "" -}} {{- end -}} {{- end -}} {{- if $description -}}

{{ $description | plainify | htmlUnescape | truncate 200 | emojify }}

{{- end -}} {{/* Platform-specific stats section */}} {{- if and $embedData $config.statsConfig -}}
{{- range $statKey, $statConfig := $config.statsConfig -}} {{- $statValue := index $embedData $statConfig.field -}} {{- if $statValue -}}
{{ partial "functions/get_icon" (dict "name" $statConfig.icon "attributes" (printf "class=\"w-4 h-4 text-%s\"" $statConfig.color)) }} {{- if and (eq $platform "github") (eq $statKey "issues") -}} {{/* Make issues count clickable for GitHub */}} {{- if gt $statValue 999 -}} {{- if gt $statValue 999999 -}} {{ div $statValue 1000000 }}M {{- else -}} {{ div $statValue 1000 }}k {{- end -}} {{- else -}} {{ $statValue }} {{- end -}} {{- else -}} {{- if gt $statValue 999 -}} {{- if gt $statValue 999999 -}} {{ div $statValue 1000000 }}M {{- else -}} {{ div $statValue 1000 }}k {{- end -}} {{- else -}} {{ $statValue }} {{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{/* Additional platform-specific content */}} {{- if eq $platform "github" -}} {{/* Show additional GitHub-specific info if available */}} {{- if and $embedData $embedData.topics -}}
{{- range first 3 $embedData.topics -}} {{ . | emojify }} {{- end -}} {{- if gt (len $embedData.topics) 3 -}} +{{ sub (len $embedData.topics) 3 }} {{- end -}}
{{- end -}} {{- end -}}