From: Danilo M. Date: Wed, 15 Apr 2026 13:52:12 +0000 (+0200) Subject: feat: create gravatar shortcode with MD5 hashing X-Git-Tag: release_22042026-1342~263 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=798970f43e522e4b54207a79bf52dee8710d84dc;p=danix.xyz-2.git feat: create gravatar shortcode with MD5 hashing --- diff --git a/themes/danix-xyz-hacker/shortcodes/gravatar.html b/themes/danix-xyz-hacker/shortcodes/gravatar.html new file mode 100644 index 0000000..7151ee5 --- /dev/null +++ b/themes/danix-xyz-hacker/shortcodes/gravatar.html @@ -0,0 +1,17 @@ +{{- $email := .Get "email" -}} +{{- $size := .Get "size" | default "256" -}} +{{- $alt := .Get "alt" | default "User avatar" -}} +{{- $class := .Get "class" | default "w-32 h-32 rounded-full" -}} + +{{- if $email -}} + {{- $hash := md5 (trim (strings.ToLower $email)) -}} + {{- $gravatarURL := printf "https://www.gravatar.com/avatar/%s?s=%s&d=identicon" $hash $size -}} + {{ $alt }} +{{- else -}} + {{- errorf "gravatar shortcode: 'email' parameter is required" -}} +{{- end -}}