summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/shortcodes/gravatar.html
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-04-15 16:38:12 +0200
committerDanilo M. <danix@danix.xyz>2026-04-15 16:38:12 +0200
commit231d29bf26820ca058dec57c06345943ca6dbbf2 (patch)
treeb60f6e4afd1bf88bcfeb02b6d28f00cc1806ccc9 /themes/danix-xyz-hacker/layouts/shortcodes/gravatar.html
parent46065a5077f113ab772e3a46f83748efe5f81caf (diff)
downloaddanixxyz-231d29bf26820ca058dec57c06345943ca6dbbf2.tar.gz
danixxyz-231d29bf26820ca058dec57c06345943ca6dbbf2.zip
Fix shortcode location: move from shortcodes/ to layouts/shortcodes/
Hugo v0.156.0+ requires shortcodes to be in layouts/shortcodes/ directory. Moved all shortcodes (gravatar, image, gallery, contact-form) to correct location. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/shortcodes/gravatar.html')
-rw-r--r--themes/danix-xyz-hacker/layouts/shortcodes/gravatar.html17
1 files changed, 17 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/gravatar.html b/themes/danix-xyz-hacker/layouts/shortcodes/gravatar.html
new file mode 100644
index 0000000..7151ee5
--- /dev/null
+++ b/themes/danix-xyz-hacker/layouts/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 -}}
+ <img
+ src="{{ $gravatarURL }}"
+ alt="{{ $alt }}"
+ class="{{ $class }}"
+ loading="lazy"
+ />
+{{- else -}}
+ {{- errorf "gravatar shortcode: 'email' parameter is required" -}}
+{{- end -}}