From 627b110437ccd089bc3d9a5160ec41569f114e82 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 5 Apr 2026 09:19:48 +0200 Subject: feat: add gravatar shortcode template Ported gravatar shortcode from previous theme. Allows embedding Gravatar images with customizable size, link, and caption. Usage: {{< gravatar mail="email@example.com" size=150 link="https://example.com" caption="Profile photo" >}} Co-Authored-By: Claude Haiku 4.5 --- layouts/shortcodes/gravatar.html | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 layouts/shortcodes/gravatar.html (limited to 'layouts') diff --git a/layouts/shortcodes/gravatar.html b/layouts/shortcodes/gravatar.html new file mode 100644 index 0000000..56e2514 --- /dev/null +++ b/layouts/shortcodes/gravatar.html @@ -0,0 +1,52 @@ +{{/* + * The gravatar shortcode: + * All arguments are optional, main ones are mail and size and have a fallback set in place. + * Args: + * mail: [string] The email address. Falls back to .Site.Params.author_email which should be set in your config file. + * size: [int] The size of the fetched image. Defaults to 200 if not set. + * class: [string] The class to give to the figure block. + * link: [string] The address to link the picture to. + * target: [string] Where to open the link. One of "_blank", "_self", "_parent", "_top". + * caption: [string] Caption text to show with the image. Supports Markdown. + * + * Usage: + * {{< gravatar mail="some@address.com" size=150 class="some class" link="https://example.com" target="_blank" rel="author" caption="Here's a picture of a dog." >}} + * + * Output: + *
+ * + *
+ *

+ * Here's a picture of a dog. + *

+ *
+ *
+ * + */}} + +{{- $mailhash := $.Site.Params.author_email -}} +{{- if .Get "mail" -}}{{- $mailhash = .Get "mail" -}}{{- end -}} +{{- $hash := $mailhash | lower | md5 -}} + + +{{- if .Get "link" -}} + +{{- end }} + {{ with .Get +{{- if .Get "link" -}} + +{{- end }} +{{- if .Get "caption" -}} +
+

+ {{- .Get "caption" | markdownify -}} +

+
+{{- end }} + -- cgit v1.2.3